Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Entity.php

function Entity::submitOptionsForm

Same name in this branch
  1. 11.1.x core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::submitOptionsForm()

Overrides PluginBase::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 (!str_contains($options['target'], '{{')) {
        if ($entity = $this->entityTypeManager
            ->getStorage($this->entityType)
            ->load($options['target'])) {
            $options['target'] = $entity->getConfigTarget();
        }
        $form_state->setValue('options', $options);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal