function StubReflectionFactory::getPluginClass

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php \Drupal\Tests\Component\Plugin\Factory\StubReflectionFactory::getPluginClass()
  2. 10 core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php \Drupal\Tests\Component\Plugin\Factory\StubReflectionFactory::getPluginClass()
  3. 11.x core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php \Drupal\Tests\Component\Plugin\Factory\StubReflectionFactory::getPluginClass()

Finds the class relevant for a given plugin.

Parameters

string $plugin_id: The id of a plugin.

\Drupal\Component\Plugin\Definition\PluginDefinitionInterface|mixed[] $plugin_definition: The plugin definition associated with the plugin ID.

string $required_interface: (optional) The required plugin interface.

Return value

string The appropriate class name.

Overrides DefaultFactory::getPluginClass

File

core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php, line 148

Class

StubReflectionFactory
Override ReflectionFactory because ::createInstance() calls a static method.

Namespace

Drupal\Tests\Component\Plugin\Factory

Code

public static function getPluginClass($plugin_id, $plugin_definition = NULL, $required_interface = NULL) {
    // Return the class name from the plugin definition.
    return $plugin_definition[$plugin_id]['class'];
}

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