public function Key::getPluginsAsOptions in Key 8
Returns a list of plugins, for use in forms.
Parameters
string $type: The plugin type to use.
Return value
array The list of plugins, indexed by ID.
File
- src/
Entity/ Key.php, line 192
Class
- Key
- Defines the Key entity.
Namespace
Drupal\key\EntityCode
public function getPluginsAsOptions($type) {
$manager = \Drupal::service("plugin.manager.key.{$type}");
$options = [];
foreach ($manager
->getDefinitions() as $id => $definition) {
$options[$id] = $definition['label'];
}
return $options;
}