loadView example

$this->view = $view;
    }
    return $this->view;
  }

  /** * {@inheritdoc} */
  public function getTitle() {
    // @todo Get the translated value from the config without instantiating the     // view. https://www.drupal.org/node/2310379     return $this->loadView()->display_handler->getOption('menu')['title'];
  }

  /** * {@inheritdoc} */
  public function getDescription() {
    return $this->loadView()->display_handler->getOption('menu')['description'];
  }

  /** * {@inheritdoc} */
// @todo Ensure that the view is not loaded with a localized description.       // https://www.drupal.org/node/2309507       '#default_value' => $this->menuLink->getDescription(),
      '#weight' => -5,
    ];

    $form += parent::buildConfigurationForm($form$form_state);

    $form['info']['#weight'] = -8;
    $form['path']['#weight'] = -7;

    $view = $this->menuLink->loadView();
    $id = $view->storage->id();
    $label = $view->storage->label();
    if ($this->moduleHandler->moduleExists('views_ui')) {
      $message = $this->t('This link is provided by the Views module. The path can be changed by editing the view <a href=":url">@label</a>', [':url' => Url::fromRoute('entity.view.edit_form', ['view' => $id])->toString(), '@label' => $label]);
    }
    else {
      $message = $this->t('This link is provided by the Views module from view %label.', ['%label' => $label]);
    }
    $form['info']['#title'] = $message;
    return $form;
  }

  
Home | Imprint | This part of the site doesn't use cookies.