You are here

interface PluginSelectorInterface in Plugin 8.2

Defines a plugin to select and configure another plugin.

Hierarchy

Expanded class hierarchy of PluginSelectorInterface

All classes that implement PluginSelectorInterface

File

src/Plugin/Plugin/PluginSelector/PluginSelectorInterface.php, line 15

Namespace

Drupal\plugin\Plugin\Plugin\PluginSelector
View source
interface PluginSelectorInterface extends PluginInspectionInterface, ConfigurableInterface {

  /**
   * Sets the human-readable label.
   *
   * @param string $label
   *
   * @return $this
   */
  public function setLabel($label);

  /**
   * Gets the human-readable label.
   *
   * @return string
   */
  public function getLabel();

  /**
   * Sets the human-readable description.
   *
   * @param string $description
   *
   * @return $this
   */
  public function setDescription($description);

  /**
   * Gets the human-readable description.
   *
   * @return string
   */
  public function getDescription();

  /**
   * Sets whether a plugin must be selected.
   *
   * @param bool $required
   *
   * @return $this
   */
  public function setRequired($required = TRUE);

  /**
   * Returns whether a plugin must be selected.
   *
   * @return bool
   */
  public function isRequired();

  /**
   * Sets whether a plugin's configuration must be collected.
   *
   * @param bool $collect
   *
   * @return $this
   */
  public function setCollectPluginConfiguration($collect = TRUE);

  /**
   * Gets whether a plugin's configuration must be collected.
   *
   * @return bool
   */
  public function getCollectPluginConfiguration();

  /**
   * Sets whether previously selected plugins must be kept.
   *
   * @param bool $keep
   *
   * @return $this
   *
   * @see self::getPreviouslySelectedPlugins()
   */
  public function setKeepPreviouslySelectedPlugins($keep = TRUE);

  /**
   * Gets whether previously selected plugins must be kept.
   *
   * @return bool
   */
  public function getKeepPreviouslySelectedPlugins();

  /**
   * Sets previously selected plugins.
   *
   * @param \Drupal\Component\Plugin\PluginInspectionInterface[] $plugins
   *
   * @return $this
   *
   * @see self::setKeepPreviouslySelectedPlugins()
   * @see self::setCollectPluginConfiguration()
   */
  public function setPreviouslySelectedPlugins(array $plugins);

  /**
   * Gets previously selected plugins.
   *
   * @return \Drupal\Component\Plugin\PluginInspectionInterface[]
   *
   * @see self::setKeepPreviouslySelectedPlugins
   */
  public function getPreviouslySelectedPlugins();

  /**
   * Gets the selected plugin.
   *
   * @return \Drupal\Component\Plugin\PluginInspectionInterface
   */
  public function getSelectedPlugin();

  /**
   * Sets the selected plugin.
   *
   * @param \Drupal\Component\Plugin\PluginInspectionInterface $plugin
   *
   * @return $this
   */
  public function setSelectedPlugin(PluginInspectionInterface $plugin);

  /**
   * Resets the selected plugin.
   *
   * This resets any default or explicitly set selected plugin.
   *
   * @return $this
   */
  public function resetSelectedPlugin();

  /**
   * Sets the selectable plugin type.
   *
   * @param \Drupal\plugin\PluginType\PluginTypeInterface $plugin_type
   *   The type of which to select plugins.
   *
   * @return $this
   */
  public function setSelectablePluginType(PluginTypeInterface $plugin_type);

  /**
   * Overrides the plugin type's discovery.
   *
   * @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface
   *
   * @return $this
   *
   * @throws \RuntimeException
   *   Thrown if the plugin type was not set using
   *   self::setSelectablePluginType().
   */
  public function setSelectablePluginDiscovery(DiscoveryInterface $plugin_discovery);

  /**
   * Overrides the plugin type's factory.
   *
   * @param \Drupal\Component\Plugin\Factory\FactoryInterface $plugin_factory
   *
   * @return $this
   *
   * @throws \RuntimeException
   *   Thrown if the plugin type was not set using
   *   self::setSelectablePluginType().
   */
  public function setSelectablePluginFactory(FactoryInterface $plugin_factory);

  /**
   * Builds the selector form.
   *
   * @param mixed[] $form
   *   Any suggested form elements to build upon. May be ignored.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state for $form and the return value. This often is not the
   *   complete (global) form state.
   *
   * @return mixed[]
   *   The form structure.
   *
   * @throws \RuntimeException
   *   Thrown if the plugin type was not set using
   *   self::setSelectablePluginType().
   */
  public function buildSelectorForm(array $form, FormStateInterface $form_state);

  /**
   * Validates the selector form.
   *
   * @param mixed[] $form
   *   The selector form as built by static::buildSelectorForm().
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state for $form. This often is not the complete (global) form
   *   state.
   */
  public function validateSelectorForm(array &$form, FormStateInterface $form_state);

  /**
   * Submits the selector form.
   *
   * @param mixed[] $form
   *   The selector form as built by static::buildSelectorForm().
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state for $form. This often is not the complete (global) form
   *   state.
   */
  public function submitSelectorForm(array &$form, FormStateInterface $form_state);

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
PluginSelectorInterface::buildSelectorForm public function Builds the selector form. 1
PluginSelectorInterface::getCollectPluginConfiguration public function Gets whether a plugin's configuration must be collected. 1
PluginSelectorInterface::getDescription public function Gets the human-readable description. 1
PluginSelectorInterface::getKeepPreviouslySelectedPlugins public function Gets whether previously selected plugins must be kept. 1
PluginSelectorInterface::getLabel public function Gets the human-readable label. 1
PluginSelectorInterface::getPreviouslySelectedPlugins public function Gets previously selected plugins. 1
PluginSelectorInterface::getSelectedPlugin public function Gets the selected plugin. 1
PluginSelectorInterface::isRequired public function Returns whether a plugin must be selected. 1
PluginSelectorInterface::resetSelectedPlugin public function Resets the selected plugin. 1
PluginSelectorInterface::setCollectPluginConfiguration public function Sets whether a plugin's configuration must be collected. 1
PluginSelectorInterface::setDescription public function Sets the human-readable description. 1
PluginSelectorInterface::setKeepPreviouslySelectedPlugins public function Sets whether previously selected plugins must be kept. 1
PluginSelectorInterface::setLabel public function Sets the human-readable label. 1
PluginSelectorInterface::setPreviouslySelectedPlugins public function Sets previously selected plugins. 1
PluginSelectorInterface::setRequired public function Sets whether a plugin must be selected. 1
PluginSelectorInterface::setSelectablePluginDiscovery public function Overrides the plugin type's discovery. 1
PluginSelectorInterface::setSelectablePluginFactory public function Overrides the plugin type's factory. 1
PluginSelectorInterface::setSelectablePluginType public function Sets the selectable plugin type. 1
PluginSelectorInterface::setSelectedPlugin public function Sets the selected plugin. 1
PluginSelectorInterface::submitSelectorForm public function Submits the selector form. 1
PluginSelectorInterface::validateSelectorForm public function Validates the selector form. 1