We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16732
    • 592 Posts
    Hi Jason,

    I did not use any script... I use the "Package builder" as is explained here but with modPlugin for class key


    In order to install events, you need a resolver script like the one for TinyMCE.
    Ok, so for my plugin with the "OnLoadWebDocument" event, I have to make a php file with something like that:

    <?php
    $success= false;
    if ($pluginid= $object->get('id')) {
        $pluginEvent= $object->xpdo->newObject('modPluginEvent');
        $pluginEvent->set('pluginid', $pluginid);
        $pluginEvent->set('evtid', 91); //OnLoadWebDocument event
        $pluginEvent->set('priority', 0);
        $success= $pluginEvent->save();
        unset($pluginEvent);
        
    }
    return $success;
    Is there a name convention for this kind of file (i.e add_plugin_events.php ??)
    Do I need to put it in a particular place ?
    • No naming convention.  It’s up to you as the package builder.  wink And it needs to go in a place that can be pulled into the package when it is built, but that’s up to you as well.
        • 28215
        • 4,149 Posts
        Quote from: laurentc at Jul 22, 2008, 07:54 AM

        Is there a name convention for this kind of file (i.e add_plugin_events.php ??)
        Do I need to put it in a particular place ?

        You’ll need to make sure you add it in the package builder as a ’PHP’ resolver, added to a vehicle (probably your plugin).

        You could also just specify the class in the "Other Class" as ’modPluginEvent’, and then select the plugin event, and make that a vehicle. It’s up to you.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 16732
          • 592 Posts
          Quote from: splittingred at Jul 22, 2008, 02:27 PM

          Quote from: laurentc at Jul 22, 2008, 07:54 AM

          Is there a name convention for this kind of file (i.e add_plugin_events.php ??)
          Do I need to put it in a particular place ?

          You’ll need to make sure you add it in the package builder as a ’PHP’ resolver, added to a vehicle (probably your plugin).


          Yes it is what I made (And it is what I wanted to tell in my last message wink ) ... and it’s workingggg laugh


          Quote from: splittingred at Jul 22, 2008, 02:27 PM

          You could also just specify the class in the "Other Class" as ’modPluginEvent’, and then select the plugin event, and make that a vehicle. It’s up to you.

          I understand this other way ... but I don’t see "Other Class" ... and if I put "modPluginEvent" in Custom Class I have a list of "null" values

            • 28215
            • 4,149 Posts
            Quote from: laurentc at Jul 22, 2008, 02:59 PM

            I understand this other way ... but I don’t see "Other Class" ... and if I put "modPluginEvent" in Custom Class I have a list of "null" values

            Hm. Probably a primary key error. I’ll probably add it in as a selectable class in alpha-4.
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com