public EntityFormDisplay::extractFormValues(FieldableEntityInterface $entity, array &$form, FormStateInterface $form_state)
Extracts field values from the submitted widget values into the entity.
This accounts for drag-and-drop reordering of field values, and filtering of empty values.
\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity.
array $form: The form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
array An array whose keys and values are the keys of the top-level entries in $form_state->getValues() that have been processed. The remaining entries, if any, do not correspond to widgets and should be extracted manually by the caller if needed.
Overrides EntityFormDisplayInterface::extractFormValues
public function extractFormValues(FieldableEntityInterface $entity, array &$form, FormStateInterface $form_state) { $extracted = array(); foreach ($entity as $name => $items) { if ($widget = $this->getRenderer($name)) { $widget->extractFormValues($items, $form, $form_state); $extracted[$name] = $name; } } return $extracted; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Entity!EntityFormDisplay.php/function/EntityFormDisplay::extractFormValues/8.1.x