function insert_media_field_widget_settings_summary_alter in Insert 8.2
Implements hook_field_widget_settings_summary_alter().
File
- modules/
insert_media/ insert_media.module, line 230
Code
function insert_media_field_widget_settings_summary_alter(array &$summary, array $context) {
/** @var \Drupal\Core\Field\WidgetInterface $plugin */
$plugin = $context['widget'];
$pluginId = $plugin
->getPluginId();
if (InsertUtility::isSourceWidget($pluginId, INSERT_TYPE_MEDIA)) {
$viewModes = _insert_media_get_view_modes();
$settings = _insert_media_settings($plugin);
$activeViewModes = array_intersect_key($viewModes, array_filter($settings['view_modes']));
$summary[] = t('Insert Media') . ': ' . (count($activeViewModes) ? implode(', ', array_map(function ($viewMode) {
/** @var \Drupal\Core\Entity\EntityViewModeInterface $viewMode */
return $viewMode
->label();
}, $activeViewModes)) : t('disabled'));
}
}