You are here

function smart_date_recur_field_widget_third_party_settings_form in Smart Date 3.2.x

Same name and namespace in other branches
  1. 3.1.x modules/smart_date_recur/smart_date_recur.module \smart_date_recur_field_widget_third_party_settings_form()
  2. 3.3.x modules/smart_date_recur/smart_date_recur.module \smart_date_recur_field_widget_third_party_settings_form()
  3. 3.4.x modules/smart_date_recur/smart_date_recur.module \smart_date_recur_field_widget_third_party_settings_form()

Implements hook_field_widget_third_party_settings_form().

Adds extra configuration fields to Smart Date fields configured to recur.

File

modules/smart_date_recur/smart_date_recur.module, line 786
Field hooks for a field that stores a start and end date as timestamps.

Code

function smart_date_recur_field_widget_third_party_settings_form($plugin, $field_definition, $form_mode, $form, $form_state) {
  if ($field_definition
    ->getType() == 'smartdate' && $field_definition
    ->getThirdPartySetting('smart_date_recur', 'allow_recurring')) {
    $element['modal'] = [
      '#type' => 'checkbox',
      '#title' => t('Use modal for managing instances'),
      '#default_value' => SmartDateRule::getThirdPartyFallback($plugin, 'modal', 1),
    ];
    $element['allowed_recur_freq_values'] = [
      '#type' => 'checkboxes',
      '#title' => t('Allowed frequency values for recurring events'),
      '#default_value' => SmartDateRule::getThirdPartyFallback($plugin, 'allowed_recur_freq_values', _smart_date_recur_get_freq_defaults()),
      '#options' => [
        'MINUTELY' => t('by Minutes'),
        'HOURLY' => t('Hourly'),
        'DAILY' => t('Daily'),
        'WEEKLY' => t('Weekly'),
        'MONTHLY' => t('Monthly'),
        'YEARLY' => t('Annually'),
      ],
    ];
    return $element;
  }
}