public function FlagFormBase::buildEntity in Flag 8.4
Builds an updated entity object based upon the submitted form values.
For building the updated entity object the form's entity is cloned and the submitted form values are copied to entity properties. The form's entity remains unchanged.
Parameters
array $form: A nested array form elements comprising the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
\Drupal\Core\Entity\EntityInterface An updated copy of the form's entity object.
Overrides EntityForm::buildEntity
See also
\Drupal\Core\Entity\EntityFormInterface::getEntity()
1 call to FlagFormBase::buildEntity()
- FlagFormBase::submitSelectPlugin in src/
Form/ FlagFormBase.php - Handles submit call when sensor type is selected.
File
- src/
Form/ FlagFormBase.php, line 289
Class
- FlagFormBase
- Provides the base flag add/edit form.
Namespace
Drupal\flag\FormCode
public function buildEntity(array $form, FormStateInterface $form_state) {
$entity = parent::buildEntity($form, $form_state);
// Update the link type plugin.
// @todo Do this somewhere else?
$entity
->setLinkTypePlugin($entity
->get('link_type'));
//debug($entity->getLinkTypePlugin()->getPluginId(), $entity->get('link_type'));
return $entity;
}