Jump to content

New Plugin attaching to Existing Controller


Recommended Posts

Can anyone advise what I need to do to get a (new) plugin to attach itself to an existing controller?


I have a plugin that adds a new table, and I want to have the data included in the Admin statistics reports for Advertisers & Campaigns.

So far I have a "demo" that works by changing stats.php and adding the plugin directly to OA_Admin_Statistics_Delivery_Controller_GlobalAdvertiser 

// Prepare the stats controller, and populate with the stats
$oStatsController = &OA_Admin_Statistics_Factory::getController ( $entity . "-" . $breakdown, $aParams );

require_once MAX_PATH . '/plugins/deliveryLog/oxLogDwellTime/DwellTime.php';
$dwplugin = & new OA_StatisticsFieldsDelivery_DwellTime (); // my plugin
$oStatsController->addPlugin ( 'oxDwellTime', $dwplugin ); // add the plugin to the controller
$oStatsController->aColumnVisible += $dwplugin->getVisibleColumns (); // add my fields to the controllers lists
$oStatsController->aColumns += $dwplugin->getFields ( $oStatsController );
$oStatsController->aColumnLinks += $dwplugin->getColumnLinks ();
$oStatsController->aEmptyRow += $dwplugin->getEmptyRow ();

... which is duplicating the logic from the controller's constructor.

But what I want to do is to have my plugin registered, or extend, all the report controllers without doing the manual hack. I assume this is possible by registering something at install time, in the XML?


Can someone point me to either a github project that does this, or suggest what I need to modify?



Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...