protected function FieldWidgetComponentType::getApplicableRendererPluginOptions in Flexiform 8
Get applicable renderer plugin options.
By default return array with 'default' as the only key.
Parameters
string $component_name: The component name.
Return value
array The options.
Overrides FormComponentTypeBase::getApplicableRendererPluginOptions
File
- src/
Plugin/ FormComponentType/ FieldWidgetComponentType.php, line 163
Class
- FieldWidgetComponentType
- Plugin for field widget component types.
Namespace
Drupal\flexiform\Plugin\FormComponentTypeCode
protected function getApplicableRendererPluginOptions($component_name) {
$field_definition = $this
->getFieldDefinition($component_name);
if (!$field_definition) {
print "NAME: " . $component_name;
}
$options = $this->pluginManager
->getOptions($field_definition
->getType());
$applicable_options = [];
foreach ($options as $option => $label) {
$plugin_class = DefaultFactory::getPluginClass($option, $this->pluginManager
->getDefinition($option));
if ($plugin_class::isApplicable($field_definition)) {
$applicable_options[$option] = $label;
}
}
return $applicable_options;
}