You are here

public function Entity::submitOptionsForm in Drupal 10

Same name in this branch
  1. 10 core/modules/views/src/Plugin/views/area/Entity.php \Drupal\views\Plugin\views\area\Entity::submitOptionsForm()
  2. 10 core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::submitOptionsForm()
Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/area/Entity.php \Drupal\views\Plugin\views\area\Entity::submitOptionsForm()
  2. 9 core/modules/views/src/Plugin/views/area/Entity.php \Drupal\views\Plugin\views\area\Entity::submitOptionsForm()

File

core/modules/views/src/Plugin/views/area/Entity.php, line 159

Class

Entity
Provides an area handler which renders an entity in a certain view mode.

Namespace

Drupal\views\Plugin\views\area

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
  parent::submitOptionsForm($form, $form_state);

  // Load the referenced entity and store its config target identifier if
  // the target does not contains tokens.
  // @todo Use a method to check for tokens in
  //   https://www.drupal.org/node/2396607.
  $options = $form_state
    ->getValue('options');
  if (strpos($options['target'], '{{') === FALSE) {
    if ($entity = $this->entityTypeManager
      ->getStorage($this->entityType)
      ->load($options['target'])) {
      $options['target'] = $entity
        ->getConfigTarget();
    }
    $form_state
      ->setValue('options', $options);
  }
}