We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33992 ☆ A M B ☆
    • 455 Posts
    Hi,
    I want to change something in codes of snippets by a plugin before they execute. is it possible?

    i found out that there are two event for snippets OnSnipFormPrerender and OnSnipFormRender. are these events my solution? so if i can access to snippets code by these events, how can i get the snippets contents? i want to replace somthing.
    and if it is possible, does it support and work with include codes?

    unfortunately i couldn’t find about plugin events more.

    please help me to create it


    Thanks you
    AHHP
      God loves me. 【ツ】


      MODX.ir (Persian Support)

      Boplo.ir/modx/ (Persian)
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      No, those events are for when the snippet editing form in the Manager is displayed. There are no events for what you want.

      The way to handle that is to add variables to the snippet to enable external modification of what you need to have modified. Then you can use snippet parameters to set these variables when you call the snippet.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 33992 ☆ A M B ☆
        • 455 Posts
        Thank you for very fast answering wink

        please see : Custom date API for different languages and calenders!
        it seems no one pay attention to it.

        i want to replace the time/date functions with my custom functions for executing with new values (my functions). i don’t want to modifiy all snippet (i can’t), i wanted to do it automatically by a plugin.

        thanks again
          God loves me. 【ツ】


          MODX.ir (Persian Support)

          Boplo.ir/modx/ (Persian)