You are here

class LinkitSearchPluginNode in Linkit 7.3

Reprecents a Linkit node search plugin.

Hierarchy

Expanded class hierarchy of LinkitSearchPluginNode

File

plugins/linkit_search/node.class.php, line 10
Define Linkit node search plugin class.

View source
class LinkitSearchPluginNode extends LinkitSearchPluginEntity {

  /**
   * Overrides LinkitSearchPluginEntity::createRowClass().
   *
   * Adds an extra class if the node is unpublished.
   */
  function createRowClass($entity) {
    if ($this->conf['include_unpublished'] && $entity->status == NODE_NOT_PUBLISHED) {
      return 'unpublished-node';
    }
  }

  /**
   * Overrides LinkitSearchPluginEntity::getQueryInstance().
   */
  function getQueryInstance() {

    // Call the parent getQueryInstance method.
    parent::getQueryInstance();

    // If we don't want to include unpublished nodes, add a condition on status.
    if ($this->conf['include_unpublished'] == 0) {
      $this->query
        ->propertyCondition('status', NODE_PUBLISHED);
    }
  }

  /**
   * Overrides LinkitSearchPlugin::buildSettingsForm().
   */
  function buildSettingsForm() {

    // Get the parent settings form.
    $form = parent::buildSettingsForm();
    $form[$this->plugin['name']]['include_unpublished'] = array(
      '#title' => t('Include unpublished nodes'),
      '#type' => 'checkbox',
      '#default_value' => isset($this->conf['include_unpublished']) ? $this->conf['include_unpublished'] : 0,
      '#description' => t('In order to see unpublished nodes, the user must also have permissions to do so. '),
    );
    return $form;
  }

}

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::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
LinkitSearchPluginEntity::$conf property Plugin specific settings.
LinkitSearchPluginEntity::$entity_field_label property The name of the property that contains the entity label.
LinkitSearchPluginEntity::$entity_info property The entity info array of an entity type.
LinkitSearchPluginEntity::$entity_key_bundle property The name of the property of the bundle object that contains the name of the bundle object.
LinkitSearchPluginEntity::$query property Entity field query instance.
LinkitSearchPluginEntity::createDescription function Create a search row description. 2
LinkitSearchPluginEntity::createGroup function Create a group text. 2
LinkitSearchPluginEntity::createLabel function Create a label of an entity.
LinkitSearchPluginEntity::createPath function Create an uri for an entity. 1
LinkitSearchPluginEntity::fetchResults public function Implements LinkitSearchPluginInterface::fetchResults(). Overrides LinkitSearchPluginInterface::fetchResults 1
LinkitSearchPluginEntity::__construct function Overrides LinkitSearchPlugin::__construct(). Overrides LinkitSearchPlugin::__construct 2
LinkitSearchPluginNode::buildSettingsForm function Overrides LinkitSearchPlugin::buildSettingsForm(). Overrides LinkitSearchPluginEntity::buildSettingsForm
LinkitSearchPluginNode::createRowClass function Overrides LinkitSearchPluginEntity::createRowClass(). Overrides LinkitSearchPluginEntity::createRowClass
LinkitSearchPluginNode::getQueryInstance function Overrides LinkitSearchPluginEntity::getQueryInstance(). Overrides LinkitSearchPluginEntity::getQueryInstance