DefaultFactory
class DefaultFactory implements FactoryInterface (View source)
Default plugin factory.
Instantiates plugin instances by passing the full configuration array as a single constructor argument. Plugin types wanting to support plugin classes with more flexible constructor signatures can do so by using an alternate factory such as Drupal\Component\Plugin\Factory\ReflectionFactory.
Properties
| protected DiscoveryInterface | $discovery | The object that retrieves the definitions of the plugins that this factory instantiates. |
|
| protected string|null | $interface | Defines an interface each plugin should implement. |
Methods
Constructs a Drupal\Component\Plugin\Factory\DefaultFactory object.
Creates a pre-configured instance of a plugin.
Finds the class relevant for a given plugin.
Details
__construct(DiscoveryInterface $discovery, string|null $plugin_interface = NULL)
Constructs a Drupal\Component\Plugin\Factory\DefaultFactory object.
object
createInstance(string $plugin_id, array $configuration = [])
Creates a pre-configured instance of a plugin.
static string
getPluginClass(string $plugin_id, PluginDefinitionInterface|array $plugin_definition = NULL, string $required_interface = NULL)
Finds the class relevant for a given plugin.