protected function EntityDisplayFormBase::getApplicablePluginOptions in Drupal 9
Same name and namespace in other branches
- 8 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::getApplicablePluginOptions()
- 10 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::getApplicablePluginOptions()
Returns an array of applicable widget or formatter options for a field.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.
Return value
array An array of applicable widget or formatter options.
1 call to EntityDisplayFormBase::getApplicablePluginOptions()
- EntityDisplayFormBase::buildFieldRow in core/
modules/ field_ui/ src/ Form/ EntityDisplayFormBase.php - Builds the table row structure for a single field.
File
- core/
modules/ field_ui/ src/ Form/ EntityDisplayFormBase.php, line 754
Class
- EntityDisplayFormBase
- Base class for EntityDisplay edit forms.
Namespace
Drupal\field_ui\FormCode
protected function getApplicablePluginOptions(FieldDefinitionInterface $field_definition) {
$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;
}