protected function CookieCategoryForm::copyFormValuesToEntity in EU Cookie Compliance (GDPR Compliance) 2.0.x
Same name and namespace in other branches
- 8 src/Form/CookieCategoryForm.php \Drupal\eu_cookie_compliance\Form\CookieCategoryForm::copyFormValuesToEntity()
Copies top-level form values to entity properties.
This should not change existing entity properties that are not being edited by this form.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the current form should operate upon.
array $form: A nested array of form elements comprising the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides EntityForm::copyFormValuesToEntity
File
- src/
Form/ CookieCategoryForm.php, line 115
Class
- CookieCategoryForm
- Class CookieCategoryForm.
Namespace
Drupal\eu_cookie_compliance\FormCode
protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
parent::copyFormValuesToEntity($entity, $form, $form_state);
// There is no weight on the edit form. Fetch all configurable cookie
// categories ordered by weight and set the new cookie to be placed
// after them.
if (empty($entity
->getWeight())) {
$entity
->setWeight($this->categoryStorageManager
->getCookieCategoryNextWeight());
}
}