You are here

public static function LinkitSearchPlugin::factory in Linkit 7.3

Implements LinkitSearchPluginInterface::factory().

Overrides LinkitSearchPluginInterface::factory

2 calls to LinkitSearchPlugin::factory()
LinkitProfile::setEnabledsearchPlugins in includes/profile.class.php
Set all enabled search plugins.
_linkit_build_search_plugin_form_fields in plugins/export_ui/linkit_profiles.inc
Append search plugin form element to the profile form.

File

includes/search_plugin.class.php, line 95
Linkit Search plugin interface.

Class

LinkitSearchPlugin
Base class for Linkit search plugins.

Code

public static function factory($plugin, LinkitProfile $profile) {
  ctools_include('plugins');

  // Make sure that the handler class exists and that it has this class as one
  // of its parents.
  if (class_exists($plugin['handler']['class']) && is_subclass_of($plugin['handler']['class'], __CLASS__)) {
    return new $plugin['handler']['class']($plugin, $profile);
  }
  else {

    // The plugin handler class is defined but it cannot be found, so lets
    // instantiate the LinkitSearchPluginBroken instead.
    return new LinkitSearchPluginBroken($plugin, $profile);
  }
}