getConfigTarget example


  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);
    }
  }

  /** * {@inheritdoc} */
  public function render($empty = FALSE) {
    if (!$empty || !empty($this->options['empty'])) {
      // @todo Use a method to check for tokens in
/** * {@inheritdoc} */
  public function getConfigDependencyName() {
    return $this->storage->getConfigDependencyName();
  }

  /** * {@inheritdoc} */
  public function getConfigTarget() {
    return $this->storage->getConfigTarget();
  }

  /** * {@inheritdoc} */
  public function onDependencyRemoval(array $dependencies) {
    return $this->storage->onDependencyRemoval($dependencies);
  }

  /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.