You are here

protected function CalendarEventEmbeddedWidget::disableRequired in Opigno calendar event 8

Same name in this branch
  1. 8 src/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\CalendarEventEmbeddedWidget::disableRequired()
  2. 8 src/Form/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\Form\CalendarEventEmbeddedWidget::disableRequired()
Same name and namespace in other branches
  1. 3.x src/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\CalendarEventEmbeddedWidget::disableRequired()

Makes the specified element and its descendants not required.

Parameters

array $element: A form element array.

1 call to CalendarEventEmbeddedWidget::disableRequired()
CalendarEventEmbeddedWidget::alterForm in src/CalendarEventEmbeddedWidget.php
Alters the parent form.

File

src/CalendarEventEmbeddedWidget.php, line 117

Class

CalendarEventEmbeddedWidget
Provides a widget to attach a calendar event to an entity.

Namespace

Drupal\opigno_calendar_event

Code

protected function disableRequired(array &$element) {
  $element['#required'] = FALSE;
  foreach (Element::children($element) as $key) {
    $this
      ->disableRequired($element[$key]);
  }
}