How to override a ctools plugin from another module I want to modify some logic of a ctools plugin defined in the entityqueue module.

The file that contains the ctools plugin definition I want to modify is: /entityqueue/plugins/entityreference/behavior/entityqueue.inclink to file

This file makes use of the class EntityReferenceBehavior_EntityQueue which is defined here. I want to modify the logic in the presave function.

Is there a way to hook into it without patching the file?
I am not entirely sure if this is the best solution but I ended up doing the following:


implemented hook_ctools_plugin_pre_alter()



function my_module_ctools_plugin_pre_alter(&$plugin, &$info) {
      if ($info['type'] == 'behavior' && $info['module'] == 'entityreference' && $plugin['class'] == 'EntityReferenceBehavior_EntityQueue') {
        $plugin['class'] = 'EntityReferenceBehavior_EntityQueue';
        $plugin['path'] = drupal_get_path('module', 'my_module')  . '/plugins/entityreference/behavior';
        $plugin['file'] = 'entityqueue.inc';
        module_load_include('php', 'my_module', '/plugins/entityreference/behavior/EntityReferenceBehavior_EntityQueue.class');
      }
    }



Then I copied the files ('/plugins/entityreference/behavior/EntityReferenceBehavior_EntityQueue.class' and '/plugins/entityreference/behavior/entityqueue.inc') in my module and modified the code of presave function.