function hook_field_widget_settings_summary_alter

Same name and namespace in other branches
  1. 9 core/modules/field_ui/field_ui.api.php \hook_field_widget_settings_summary_alter()
  2. 8.9.x core/modules/field_ui/field_ui.api.php \hook_field_widget_settings_summary_alter()
  3. 10 core/modules/field_ui/field_ui.api.php \hook_field_widget_settings_summary_alter()

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\Form\EntityFormDisplayEditForm::alterSettingsSummary()

Related topics

1 function implements hook_field_widget_settings_summary_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

field_third_party_test_field_widget_settings_summary_alter in core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module
Implements hook_field_widget_settings_summary_alter().

File

core/modules/field_ui/field_ui.api.php, line 115

Code

function hook_field_widget_settings_summary_alter(array &$summary, array $context) {
    // Append a message to the summary when an instance of foo_widget has
    // my_setting 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.');
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.