I am trying to add a custom ctools selection plugin for entity reference field as explained Here but it is never bing called but it is calling the parent class (EntityReference_SelectionHandler_Generic). Following is my code.
1) Implements hook_ctools_plugin_directory
function mymodule_ctools_plugin_directory($module, $plugin) {
if ($module == 'entityreference') {
dsm($plugin);
return 'plugins/' . $plugin;
}
}
Than I created "plugins/selection" folder in my module directory following is the code I have in this file respectively-
1) Base.inc
$plugin = array(
'title' => t('Simple (with optional filter by bundle)'),
'class' => 'myClass',
'weight' => -100,
);
2) myClass.class.php
class myClass extends EntityReference_SelectionHandler_Generic{
public static function getInstance($field, $instance = NULL, $entity_type = NULL, $entity = NULL) {
watchdog('getInstance', "print something for test ");
return new ExampleSelectionHandler($field, $instance, $entity_type, $entity);
} public function buildEntityFieldQuery($match = NULL, $match_operator =CONTAINS'){ } }
But Myclass is never getting called instate it is calling the parent class(I have added a watchdog in that class).