You are here

public function CalendarEventEmbeddedWidget::getWidgetState in Opigno calendar event 3.x

Same name in this branch
  1. 3.x src/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\CalendarEventEmbeddedWidget::getWidgetState()
  2. 3.x src/Form/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\Form\CalendarEventEmbeddedWidget::getWidgetState()
Same name and namespace in other branches
  1. 8 src/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\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/CalendarEventEmbeddedWidget.php
Alters the parent form.
CalendarEventEmbeddedWidget::buildEntity in src/CalendarEventEmbeddedWidget.php
Entity builder method.
CalendarEventEmbeddedWidget::getItemFormDisplay in src/CalendarEventEmbeddedWidget.php
Returns the form display for the specified subform item.
CalendarEventEmbeddedWidget::getItemFormObject in src/CalendarEventEmbeddedWidget.php
Returns a entity form object for the specified subform item.
CalendarEventEmbeddedWidget::getItemFormState in src/CalendarEventEmbeddedWidget.php
Returns the form state of the specified subform item.

... See full list

File

src/CalendarEventEmbeddedWidget.php, line 267

Class

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

Namespace

Drupal\opigno_calendar_event

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;
}