You are here

public function CalendarEventEmbeddedWidget::getWidgetState in Opigno calendar event 8

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

Returns the state of the whole widget.

Parameters

array $form: The form array.

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

Return value

array An associative array of widget state data.

8 calls to CalendarEventEmbeddedWidget::getWidgetState()
CalendarEventEmbeddedWidget::alterForm in src/Form/CalendarEventEmbeddedWidget.php
Alters the parent form.
CalendarEventEmbeddedWidget::buildEntity in src/Form/CalendarEventEmbeddedWidget.php
Entity builder method.
CalendarEventEmbeddedWidget::getItemFormDisplay in src/Form/CalendarEventEmbeddedWidget.php
Returns the form display for the specified subform item.
CalendarEventEmbeddedWidget::getItemFormObject in src/Form/CalendarEventEmbeddedWidget.php
Returns a entity form object for the specified subform item.
CalendarEventEmbeddedWidget::getItemFormState in src/Form/CalendarEventEmbeddedWidget.php
Returns the form state of the specified subform item.

... See full list

File

src/Form/CalendarEventEmbeddedWidget.php, line 269

Class

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

Namespace

Drupal\opigno_calendar_event\Form

Code

public function &getWidgetState(array $form, FormStateInterface $form_state) {
  $storage =& $form_state
    ->getStorage();
  $parents = array_merge([
    'field_storage',
    '#parents',
  ], $form['#parents'], [
    '#fields',
    static::ELEMENT_NAME,
  ]);
  $widget_state =& NestedArray::getValue($storage, $parents, $key_exists);
  if (!$key_exists) {
    NestedArray::setValue($storage, $parents, []);
    $widget_state =& NestedArray::getValue($storage, $parents, $key_exists);
  }
  return $widget_state;
}