diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc index 44770ac..ad966f8 100644 --- a/modules/field_ui/field_ui.admin.inc +++ b/modules/field_ui/field_ui.admin.inc @@ -1051,6 +1051,16 @@ function field_ui_display_overview_form($form, &$form_state, $entity_type, $bund $settings_form = $function($field, $instance, $view_mode, $form, $form_state); } + // Allow other modules to alter the formater settings form. + $context = array( + 'module' => $formatter['module'], + 'formatter' => $formatter, + 'field' => $field, + 'instance' => $instance, + 'view_mode' => $view_mode, + 'form' => $form, + ); + drupal_alter('field_formatter_settings_form', $settings_form, $form_state, $context); if ($settings_form) { $table[$name]['format']['#cell_attributes'] = array('colspan' => 3); $table[$name]['format']['settings_edit_form'] = array( @@ -1086,6 +1096,12 @@ function field_ui_display_overview_form($form, &$form_state, $entity_type, $bund else { // Display a summary of the current formatter settings. $summary = module_invoke($formatter['module'], 'field_formatter_settings_summary', $field, $instance, $view_mode); + $context = array( + 'field' => $field, + 'instance' => $instance, + 'view_mode' => $view_mode, + ); + drupal_alter('field_formatter_settings_summary', $summary, $context); $table[$name]['settings_summary'] = array(); $table[$name]['settings_edit'] = array(); if ($summary) { diff --git a/modules/field_ui/field_ui.api.php b/modules/field_ui/field_ui.api.php index 05d9f05..57ef9d6 100644 --- a/modules/field_ui/field_ui.api.php +++ b/modules/field_ui/field_ui.api.php @@ -170,6 +170,41 @@ function hook_field_formatter_settings_form($field, $instance, $view_mode, $form } /** + * Alter the formatter settings form. + * + * @param $element + * Form array as returned by hook_field_formatter_settings_form(). + * @param $form_state + * The form state of the (entire) configuration form. + * @param $context + * An associative array with the following elements: + * - 'module': The module that contains the definition of this formatter. + * - 'formatter': The formatter type description array. + * - 'field': The field structure being configured. + * - 'instance': The instance structure being configured. + * - 'view_mode': The view mode being configured. + * - 'form': The (entire) configuration form array. + */ +function hook_field_formatter_settings_form_alter(&$settings_form, &$form_state, $context) { + +} + +/** + * Alter the field formatter settings summary. + * + * @param $summary + * The summary as returned by hook_field_formatter_settings_summary(). + * @param $context + * An associative array with the following elements: + * - 'field': The field structure being configured. + * - 'instance': The instance structure being configured. + * - 'view_mode': The view mode being configured. + */ +function hook_field_formatter_settings_summary_alter(&$sumary, $context) { + +} + +/** * Return a short summary for the current formatter settings of an instance. * * If an empty result is returned, the formatter is assumed to have no