linkit.api.php 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Implements hook_linkit_plugin_entities_alter().
  4. *
  5. * The default behavior for entities is that they will use the default entity
  6. * search plugin class, which will provide them with the basic methods they
  7. * need.
  8. *
  9. * Tho there can be some search plugins that will extend those basic method with
  10. * more advanced once, therefore the handlers for those plugins will have to be
  11. * changed.
  12. *
  13. * Make sure that your classes is included in the regisrty.
  14. * The easiest way to do this is by define them as
  15. *
  16. * <code> files[] = plugins/linkit_search/my_custom_plugin.class.php </code>
  17. *
  18. * @param $plugins
  19. * An array of all search plugins processed within Linkit entity plugin.
  20. */
  21. function hook_linkit_search_plugin_entities_alter(&$plugins) {
  22. $path = drupal_get_path('module', 'mymodule') . '/plugins/linkit_search';
  23. if (isset($plugins['my_custom_plugin'])) {
  24. $handler = array(
  25. 'class' => 'MyCustomPlugin',
  26. 'file' => 'my_custom_plugin.class.php',
  27. 'path' => $path,
  28. );
  29. $plugins['my_custom_plugin']['handler'] = $handler;
  30. }
  31. }