You are here

public function Entity::submitOptionsForm in Zircon Profile 8.0

Same name in this branch
  1. 8.0 core/modules/views/src/Plugin/views/area/Entity.php \Drupal\views\Plugin\views\area\Entity::submitOptionsForm()
  2. 8.0 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()

Handle any special handling on the validate form.

Overrides PluginBase::submitOptionsForm

File

core/modules/views/src/Plugin/views/area/Entity.php, line 140
Contains \Drupal\views\Plugin\views\area\Entity.

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->entityManager
      ->getStorage($this->entityType)
      ->load($options['target'])) {
      $options['target'] = $entity
        ->getConfigTarget();
    }
    $form_state
      ->setValue('options', $options);
  }
}