protected function CalendarEventEmbeddedWidget::getItemFormState in Opigno calendar event 8
Same name in this branch
- 8 src/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\CalendarEventEmbeddedWidget::getItemFormState()
- 8 src/Form/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\Form\CalendarEventEmbeddedWidget::getItemFormState()
Same name and namespace in other branches
- 3.x src/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\CalendarEventEmbeddedWidget::getItemFormState()
Returns the form state of the specified subform item.
Parameters
array $form: The parent form array.
\Drupal\Core\Form\FormStateInterface $form_state: The parent form state.
int $delta: The item delta.
Return value
\Drupal\Core\Form\FormStateInterface A form state object.
3 calls to CalendarEventEmbeddedWidget::getItemFormState()
- CalendarEventEmbeddedWidget::getItemFormObject in src/
CalendarEventEmbeddedWidget.php - Returns a entity form object for the specified subform item.
- CalendarEventEmbeddedWidget::submitForm in src/
CalendarEventEmbeddedWidget.php - Submit handler.
- CalendarEventEmbeddedWidget::validateForm in src/
CalendarEventEmbeddedWidget.php - Validation handler.
File
- src/
CalendarEventEmbeddedWidget.php, line 366
Class
- CalendarEventEmbeddedWidget
- Provides a widget to attach a calendar event to an entity.
Namespace
Drupal\opigno_calendar_eventCode
protected function getItemFormState(array $form, FormStateInterface $form_state, $delta) {
$widget_state =& $this
->getWidgetState($form, $form_state);
$item_state =& $widget_state['items'][$delta];
if (!isset($item_state['form_state'])) {
$item_state['form_state'] = clone $form_state;
$item_values = array_intersect_key($form_state
->getValues(), [
static::ELEMENT_NAME => TRUE,
]);
$item_state['form_state']
->setValues($item_values);
}
return $item_state['form_state'];
}