DeriverInterface.php 1.4 KB
Newer Older
1 2 3 4 5
<?php

namespace Drupal\Component\Plugin\Derivative;

/**
6
 * Provides additional plugin definitions based on an existing definition.
7 8
 *
 * @ingroup plugin_api
9
 */
10
interface DeriverInterface {
11 12

  /**
13
   * Gets the definition of a derivative plugin.
14 15 16 17
   *
   * @param string $derivative_id
   *   The derivative id. The id must uniquely identify the derivative within a
   *   given base plugin, but derivative ids can be reused across base plugins.
18
   * @param array|\Drupal\Component\Plugin\Definition\PluginDefinitionInterface $base_plugin_definition
19 20 21
   *   The definition of the base plugin from which the derivative plugin
   *   is derived. It is maybe an entire object or just some array, depending
   *   on the discovery mechanism.
22 23 24 25 26 27
   *
   * @return array
   *   The full definition array of the derivative plugin, typically a merge of
   *   $base_plugin_definition with extra derivative-specific information. NULL
   *   if the derivative doesn't exist.
   */
28
  public function getDerivativeDefinition($derivative_id, $base_plugin_definition);
29 30

  /**
31
   * Gets the definition of all derivatives of a base plugin.
32 33 34
   *
   * @param array $base_plugin_definition
   *   The definition array of the base plugin.
35
   *
36 37 38 39 40
   * @return array
   *   An array of full derivative definitions keyed on derivative id.
   *
   * @see getDerivativeDefinition()
   */
41
  public function getDerivativeDefinitions($base_plugin_definition);
42 43

}