You are here

public function AddToCalendarField::fieldSettingsForm in Add To Calendar Button (AddEvent.com) 8.4

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldType/AddToCalendarField.php \Drupal\addtocalendar\Plugin\Field\FieldType\AddToCalendarField::fieldSettingsForm()

Returns a form for the field-level settings.

Invoked from \Drupal\field_ui\Form\FieldConfigEditForm to allow administrators to configure field-level settings.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The form state of the (entire) configuration form.

Return value

array The form definition for the field settings.

Overrides BooleanItem::fieldSettingsForm

File

src/Plugin/Field/FieldType/AddToCalendarField.php, line 40

Class

AddToCalendarField
Plugin implementation of the 'my_test_field' field type.

Namespace

Drupal\addtocalendar\Plugin\Field\FieldType

Code

public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
  $element = parent::fieldSettingsForm($form, $form_state);
  $settings = $this
    ->getSettings();
  $element['off_label']['#required'] = FALSE;
  $field_definition = $this->definition
    ->getFieldDefinition();

  // Build add to calendar widget settings form.
  $element += _addtocalendar_build_form($settings, $field_definition);
  $element['addtocalendar_show']['#title'] = t('Add to Calendar settings');
  $element['on_label']['#title'] = $this
    ->t('Display Text');
  $element['off_label']['#title'] = $this
    ->t('Disabled Text');
  unset($element['addtocalendar_settings']['display_text']);
  return $element;
}