You are here

abstract class LinkitSearchPlugin in Linkit 7.3

Base class for Linkit search plugins.

Hierarchy

Expanded class hierarchy of LinkitSearchPlugin

1 string reference to 'LinkitSearchPlugin'
linkit_entity_ctools_linkit_get_children in plugins/linkit_search/entity.inc
Get all child Linkit search plugins.

File

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

View source
abstract class LinkitSearchPlugin implements LinkitSearchPluginInterface {

  /**
   * The plugin definition for this instance.
   *
   * @var array
   */
  protected $plugin;

  /**
   * The profile instance for this instance.
   *
   * @var LinkitProfile object
   */
  protected $profile;

  /**
   * Initialize this search plugin with the search plugin and the profile.
   *
   * @param $plugin
   *   A search plugin object.
   *
   * @param LinkitProfile $profile
   *   A LinkitProfile object.
   */
  public function __construct($plugin, LinkitProfile $profile) {
    $this->plugin = $plugin;
    $this->profile = $profile;
  }

  /**
   * Implements LinkitSearchPluginInterface::factory().
   */
  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);
    }
  }

  /**
   * Implements LinkitSearchPluginInterface::ui_title().
   */
  public function ui_title() {
    if (!isset($this->plugin['ui_title'])) {
      return check_plain($this->plugin['module'] . ':' . $this->plugin['name']);
    }
    return check_plain($this->plugin['ui_title']);
  }

  /**
   * Implements LinkitSearchPluginInterface::ui_description().
   */
  public function ui_description() {
    if (isset($this->plugin['ui_description'])) {
      return check_plain($this->plugin['ui_description']);
    }
  }

  /**
   * Generate a settings form for this handler.
   * Uses the standard Drupal FAPI.
   *
   * @return
   *   An array containing any custom form elements to be displayed in the
   *   profile editing form
   */
  public function buildSettingsForm() {
  }

  /**
   * Determine if the handler is considered 'broken', meaning it's a
   * a placeholder used when a handler can't be found.
   */
  public function broken() {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LinkitSearchPlugin::$plugin protected property The plugin definition for this instance.
LinkitSearchPlugin::$profile protected property The profile instance for this instance.
LinkitSearchPlugin::broken public function Determine if the handler is considered 'broken', meaning it's a a placeholder used when a handler can't be found. 1
LinkitSearchPlugin::buildSettingsForm public function Generate a settings form for this handler. Uses the standard Drupal FAPI. 1
LinkitSearchPlugin::factory public static function Implements LinkitSearchPluginInterface::factory(). Overrides LinkitSearchPluginInterface::factory
LinkitSearchPlugin::ui_description public function Implements LinkitSearchPluginInterface::ui_description(). Overrides LinkitSearchPluginInterface::ui_description 2
LinkitSearchPlugin::ui_title public function Implements LinkitSearchPluginInterface::ui_title(). Overrides LinkitSearchPluginInterface::ui_title 2
LinkitSearchPlugin::__construct public function Initialize this search plugin with the search plugin and the profile. 1
LinkitSearchPluginInterface::fetchResults public function Fetch search results based on the $search_string. 2