function hook_field_widget_settings_summary_alter

hook_field_widget_settings_summary_alter(&$summary, $context)

Alters the field widget settings summary.

Parameters

array $summary: An array of summary messages.

array $context: An associative array with the following elements:

  • widget: The widget object.
  • field_definition: The field definition.
  • form_mode: The form mode being configured.

See also

\Drupal\field_ui\FormDisplayOverView

Related topics

Field Types API
Defines field, widget, display formatter, and storage types.

File

core/modules/field_ui/field_ui.api.php, line 115
Hooks provided by the Field UI module.

Code

function hook_field_widget_settings_summary_alter(&$summary, $context) {
  // Append a message to the summary when an instance of foo_widget has
  // mysetting set to TRUE for the current view mode.
  if ($context['widget']->getPluginId() == 'foo_widget') {
    if ($context['widget']->getThirdPartySetting('my_module', 'my_setting')) {
      $summary[] = t('My setting enabled.');
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!field_ui!field_ui.api.php/function/hook_field_widget_settings_summary_alter/8.1.x