You are here

public function CalendarEventManager::addEmbeddedWidgetSettings in Opigno calendar event 8

Same name and namespace in other branches
  1. 3.x src/CalendarEventManager.php \Drupal\opigno_calendar_event\CalendarEventManager::addEmbeddedWidgetSettings()

Adds the widget settings to the specified form.

Parameters

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

File

src/CalendarEventManager.php, line 110

Class

CalendarEventManager
The calendar event manager.

Namespace

Drupal\opigno_calendar_event

Code

public function addEmbeddedWidgetSettings(array &$form, FormStateInterface $form_state) {

  /** @var \Drupal\field_ui\Form\FieldConfigEditForm $form_object */
  $form_object = $form_state
    ->getFormObject();

  /** @var \Drupal\field\FieldConfigInterface $field */
  $field = $form_object
    ->getEntity();
  $form['third_party_settings']['opigno_calendar_event']['embedded_widget'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Calendar event widget'),
    '#description' => $this
      ->t('If this is enabled a <em>Show on calendar</em> widget will be displayed on the referenced entity form.'),
    '#default_value' => $field
      ->getThirdPartySetting('opigno_calendar_event', 'embedded_widget'),
  ];
}