function commerce_field_formatter_info_alter in Commerce Core 8.2
Implements hook_field_formatter_info_alter().
Exposes the commerce_plugin_item_default formatter for each of the field type's derivatives, since core does not do it automatically.
File
- ./
commerce.module, line 101 - Defines common functionality for all Commerce modules.
Code
function commerce_field_formatter_info_alter(array &$info) {
if (isset($info['commerce_plugin_item_default'])) {
$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
foreach ($field_type_manager
->getDefinitions() as $key => $definition) {
if ($definition['id'] == 'commerce_plugin_item') {
$info['commerce_plugin_item_default']['field_types'][] = $key;
}
}
}
}