You are here

ConfigurableSearchPluginBase.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php

File

core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php
View source
<?php

/**
 * @file
 * Contains \Drupal\search\Plugin\ConfigurableSearchPluginBase.
 */
namespace Drupal\search\Plugin;

use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Form\FormStateInterface;

/**
 * Provides a base implementation for a configurable Search plugin.
 */
abstract class ConfigurableSearchPluginBase extends SearchPluginBase implements ConfigurableSearchPluginInterface {

  /**
   * The unique ID for the search page using this plugin.
   *
   * @var string
   */
  protected $searchPageId;

  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->configuration = NestedArray::mergeDeep($this
      ->defaultConfiguration(), $this->configuration);
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return array();
  }

  /**
   * {@inheritdoc}
   */
  public function getConfiguration() {
    return $this->configuration;
  }

  /**
   * {@inheritdoc}
   */
  public function setConfiguration(array $configuration) {
    $this->configuration = $configuration;
  }

  /**
   * {@inheritdoc}
   */
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    return array();
  }

  /**
   * {@inheritdoc}
   */
  public function setSearchPageId($search_page_id) {
    $this->searchPageId = $search_page_id;
    return $this;
  }

}

Classes

Namesort descending Description
ConfigurableSearchPluginBase Provides a base implementation for a configurable Search plugin.