You are here

class LinkitPluginNode in Linkit 7.2

@file Define Linkit node plugin class.

Hierarchy

Expanded class hierarchy of LinkitPluginNode

File

plugins/linkit_plugins/linkit-plugin-node.class.php, line 6
Define Linkit node plugin class.

View source
class LinkitPluginNode extends LinkitPluginEntity {

  /**
   * Returns a string which will be used as the search result label for this
   * item.
   */
  function buildLabel($entity) {
    $label = parent::buildLabel($entity);
    return $label;
  }

  /**
   * Returns a string with CSS classes that will be added to the search result
   * row for this item.
   */
  function buildRowClass($entity) {
    if ($this->conf['include_unpublished'] && $entity->status == NODE_NOT_PUBLISHED) {
      return 'unpublished-node';
    }
  }

  /**
   * Start a new EntityFieldQuery instance.
   */
  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);
    }
  }

  /**
   * Generate a settings form for this handler.
   * Uses the standard Drupal FAPI.
   * The element will be attached to the "data" key.
   *
   * @return
   *   An array containing any custom form elements to be displayed in the
   *   profile editing form.
   */
  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,
    );
    return $form;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LinkitPlugin::broken function Determine if the handler is considered 'broken', meaning it's a a placeholder used when a handler can't be found. 1
LinkitPlugin::setSearchString function Set the search string.
LinkitPlugin::ui_description function Return a string representing this handler's description in the UI. 2
LinkitPlugin::ui_title function Return a string representing this handler's name in the UI. 2
LinkitPluginEntity::$conf property Plugin specific settings.
LinkitPluginEntity::$entity_field_label property The name of the property that contains the entity label.
LinkitPluginEntity::$entity_info property The entity info array of an entity type.
LinkitPluginEntity::$entity_key_bundle property The name of the property of the bundle object that contains the name of the bundle object.
LinkitPluginEntity::$query property Entity field query instance.
LinkitPluginEntity::autocomplete_callback function The autocomplete callback function for the Linkit Entity plugin. Overrides LinkitPluginInterface::autocomplete_callback 1
LinkitPluginEntity::buildDescription function Build the search row description. Overrides LinkitPlugin::buildDescription 1
LinkitPluginEntity::buildGroup function When "group_by_bundle" is active, we need to add the bundle name to the group, else just return the entity label. Overrides LinkitPlugin::buildGroup 2
LinkitPluginEntity::buildPath function Build an URL based in the path and the options. Overrides LinkitPlugin::buildPath 1
LinkitPluginEntity::buildReverseMenuTrail function Builds a reverse menu trail for the entity.
LinkitPluginEntity::__construct function Initialize this plugin with the plugin, profile, and entity specific variables. Overrides LinkitPlugin::__construct 2
LinkitPluginNode::buildLabel function Returns a string which will be used as the search result label for this item. Overrides LinkitPluginEntity::buildLabel
LinkitPluginNode::buildRowClass function Returns a string with CSS classes that will be added to the search result row for this item. Overrides LinkitPlugin::buildRowClass
LinkitPluginNode::buildSettingsForm function Generate a settings form for this handler. Uses the standard Drupal FAPI. The element will be attached to the "data" key. Overrides LinkitPluginEntity::buildSettingsForm
LinkitPluginNode::getQueryInstance function Start a new EntityFieldQuery instance. Overrides LinkitPluginEntity::getQueryInstance