function TestHelpTopicDeriver::getDerivativeDefinitions

Same name and namespace in other branches
  1. 11.x core/modules/help/tests/modules/help_topics_test/src/Plugin/Deriver/TestHelpTopicDeriver.php \Drupal\help_topics_test\Plugin\Deriver\TestHelpTopicDeriver::getDerivativeDefinitions()
  2. 10 core/modules/help/tests/modules/help_topics_test/src/Plugin/Deriver/TestHelpTopicDeriver.php \Drupal\help_topics_test\Plugin\Deriver\TestHelpTopicDeriver::getDerivativeDefinitions()
  3. 9 core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/Deriver/TestHelpTopicDeriver.php \Drupal\help_topics_test\Plugin\Deriver\TestHelpTopicDeriver::getDerivativeDefinitions()
  4. 8.9.x core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/Deriver/TestHelpTopicDeriver.php \Drupal\help_topics_test\Plugin\Deriver\TestHelpTopicDeriver::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array|\Drupal\Component\Plugin\Definition\PluginDefinitionInterface $base_plugin_definition: 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.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverInterface::getDerivativeDefinitions

File

core/modules/help/tests/modules/help_topics_test/src/Plugin/Deriver/TestHelpTopicDeriver.php, line 17

Class

TestHelpTopicDeriver
A test discovery deriver for fake help topics.

Namespace

Drupal\help_topics_test\Plugin\Deriver

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $prefix = $base_plugin_definition['id'];
  $id = 'test_derived_topic';
  $plugin_id = $prefix . ':' . $id;
  $definitions[$id] = [
    'plugin_id' => $plugin_id,
    'id' => $plugin_id,
    'class' => 'Drupal\\help_topics_test\\Plugin\\HelpTopic\\TestHelpTopicPlugin',
    'label' => 'Label for ' . $id,
    'body' => 'Body for ' . $id,
    'top_level' => TRUE,
    'related' => [],
    'provider' => 'help_topics_test',
  ];
  return $definitions;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.