protected function ComponentBlock::getApplicablePluginOptions in Component blocks 1.x
Same name and namespace in other branches
- 1.0.x src/Plugin/Block/ComponentBlock.php \Drupal\component_blocks\Plugin\Block\ComponentBlock::getApplicablePluginOptions()
- 1.1.x src/Plugin/Block/ComponentBlock.php \Drupal\component_blocks\Plugin\Block\ComponentBlock::getApplicablePluginOptions()
Returns an array of applicable formatter options for a field.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.
Return value
array An array of applicable formatter options.
See also
\Drupal\field_ui\Form\EntityDisplayFormBase::getApplicablePluginOptions()
1 call to ComponentBlock::getApplicablePluginOptions()
- ComponentBlock::formatterSettingsProcessCallback in src/
Plugin/ Block/ ComponentBlock.php - Render API callback: builds the formatter settings elements.
File
- src/
Plugin/ Block/ ComponentBlock.php, line 463
Class
- ComponentBlock
- Defines a class for a specially shaped block.
Namespace
Drupal\component_blocks\Plugin\BlockCode
protected function getApplicablePluginOptions(FieldDefinitionInterface $field_definition) {
$options = $this
->formatterPluginManager()
->getOptions($field_definition
->getType());
$applicable_options = [];
foreach ($options as $option => $label) {
$plugin_class = DefaultFactory::getPluginClass($option, $this
->formatterPluginManager()
->getDefinition($option));
if ($plugin_class::isApplicable($field_definition)) {
$applicable_options[$option] = $label;
}
}
return $applicable_options;
}