function ComponentPluginManager::find
Gets a component for rendering.
Parameters
string $component_id: The component ID.
Return value
\Drupal\Core\Plugin\Component The component.
Throws
\Drupal\Core\Render\Component\Exception\ComponentNotFoundException
File
-
core/
lib/ Drupal/ Core/ Theme/ ComponentPluginManager.php, line 133
Class
- ComponentPluginManager
- Defines a plugin manager to deal with components.
Namespace
Drupal\Core\ThemeCode
public function find(string $component_id) : Component {
$definitions = $this->getDefinitions();
if (empty($definitions)) {
throw new ComponentNotFoundException('Unable to find any component definition.');
}
$negotiated_plugin_id = $this->componentNegotiator
->negotiate($component_id, $definitions);
return $this->createInstance($negotiated_plugin_id ?? $component_id);
}