public function EntityEmbedDialog::validateEmbedStep in Entity Embed 8
Form validation handler for the entity embedding step.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
1 call to EntityEmbedDialog::validateEmbedStep()
- EntityEmbedDialog::validateForm in src/
Form/ EntityEmbedDialog.php - Form validation handler.
File
- src/
Form/ EntityEmbedDialog.php, line 642
Class
- EntityEmbedDialog
- Provides a form to embed entities by specifying data attributes.
Namespace
Drupal\entity_embed\FormCode
public function validateEmbedStep(array $form, FormStateInterface $form_state) {
// Validate configuration forms for the Entity Embed Display plugin used.
$entity_element = $form_state
->getValue('attributes');
$entity = $form_state
->get('entity');
$plugin_id = $entity_element['data-entity-embed-display'];
$plugin_settings = !empty($entity_element['data-entity-embed-display-settings']) ? $entity_element['data-entity-embed-display-settings'] : [];
$display = $this->entityEmbedDisplayManager
->createInstance($plugin_id, $plugin_settings);
$display
->setContextValue('entity', $entity);
$display
->setAttributes($entity_element);
$display
->validateConfigurationForm($form, $form_state);
}