You are here

public function LayoutDeriver::getDerivativeDefinitions in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php \Drupal\Tests\Core\Layout\LayoutDeriver::getDerivativeDefinitions()
  2. 9 core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php \Drupal\Tests\Core\Layout\LayoutDeriver::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

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

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php, line 399

Class

LayoutDeriver
Provides a dynamic layout deriver for the test.

Namespace

Drupal\Tests\Core\Layout

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  if ($base_plugin_definition
    ->get('array_based')) {
    $this->derivatives['array_based'] = [];
  }
  if ($base_plugin_definition
    ->get('invalid_provider')) {
    $this->derivatives['invalid_provider'] = new LayoutDefinition([
      'id' => 'invalid_provider',
      'provider' => 'invalid_provider',
    ]);
    $this->derivatives['invalid_provider']
      ->setClass(LayoutInterface::class);
  }
  return $this->derivatives;
}