public static function FormatterHelper::formatterOptions in Field Group 8.3
Return an array of field_group_formatter options.
2 calls to FormatterHelper::formatterOptions()
- FieldGroupAddForm::buildFormatterSelectionForm in src/
Form/ FieldGroupAddForm.php - Build the formatter selection step.
- field_group_field_ui_display_form_alter in includes/
field_ui.inc - Function to alter the display overview screens.
File
- src/
FormatterHelper.php, line 17
Class
- FormatterHelper
- Static methods for fieldgroup formatters.
Namespace
Drupal\field_groupCode
public static function formatterOptions($type) {
$options =& drupal_static(__FUNCTION__);
if (!isset($options)) {
$options = [];
$manager = \Drupal::service('plugin.manager.field_group.formatters');
$formatters = $manager
->getDefinitions();
foreach ($formatters as $formatter) {
if (in_array($type, $formatter['supported_contexts'])) {
$options[$formatter['id']] = $formatter['label'];
}
}
}
return $options;
}