You are here

function hook_date_field_formatter_settings_form_alter in Date 8

Same name and namespace in other branches
  1. 7.3 date.api.php \hook_date_field_formatter_settings_form_alter()
  2. 7.2 date.api.php \hook_date_field_formatter_settings_form_alter()

Alter a date field formatter settings form.

Parameters

array $form: Nested array of form elements that comprise the form.

array $form_state: A keyed array containing the current state of the form.

array $context: An associative array containing the following keys:

  • field: The $field array.
  • instance: The $instance array.
  • view_mode: The formatter view mode.

See also

hook_field_formatter_settings_form()

1 function implements hook_date_field_formatter_settings_form_alter()

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

date_repeat_field_date_field_formatter_settings_form_alter in date_repeat_field/date_repeat_field.module
Implements hook_date_field_foramatter_settings_form_alter().
4 invocations of hook_date_field_formatter_settings_form_alter()
DateDefaultFormatter::settingsForm in lib/Drupal/date/Plugin/field/formatter/DateDefaultFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsForm().
DateFieldDefaultFormatter::settingsForm in date_field/lib/Drupal/date_field/Plugin/field/formatter/DateFieldDefaultFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsForm().
DateFieldFormatIntervalFormatter::settingsForm in date_field/lib/Drupal/date_field/Plugin/field/formatter/DateFieldFormatIntervalFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsForm().
FormatIntervalFormatter::settingsForm in lib/Drupal/date/Plugin/field/formatter/FormatIntervalFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsForm().

File

./date.api.php, line 441
Hooks provided by the Date module.

Code

function hook_date_field_formatter_settings_form_alter(&$form, &$form_state, $context) {
  $field = $context['field'];
  $instance = $context['instance'];
  $view_mode = $context['view_mode'];
  $settings = $context['settings'];
  $formatter = $context['formatter'];
  if ($formatter == 'date_default') {
    $form['show_repeat_rule'] = array(
      '#title' => t('Repeat rule:'),
      '#type' => 'select',
      '#options' => array(
        'show' => t('Show repeat rule'),
        'hide' => t('Hide repeat rule'),
      ),
      '#default_value' => $settings['show_repeat_rule'],
      '#access' => $field['settings']['repeat'],
      '#weight' => 5,
    );
  }
}