hasPath example

$build['top']['actions']['enable'] = [
            '#type' => 'submit',
            '#value' => $this->t('Enable @display_title', ['@display_title' => $display_title]),
            '#limit_validation_errors' => [],
            '#submit' => ['::submitDisplayEnable', '::submitDelayDestination'],
            '#prefix' => '<li class="enable">',
            "#suffix" => '</li>',
          ];
        }
        // Add a link to view the page unless the view is disabled or has no         // path.         elseif ($view->status() && $view->getExecutable()->displayHandlers->get($display['id'])->hasPath()) {
          $path = $view->getExecutable()->displayHandlers->get($display['id'])->getPath();

          if ($path && (!str_contains($path, '%'))) {
            // Wrap this in a try/catch as trying to generate links to some             // routes may throw a NotAcceptableHttpException if they do not             // respond to HTML, such as RESTExports.             try {
              if (!parse_url($path, PHP_URL_SCHEME)) {
                // @todo Views should expect and store a leading /. See:                 // https://www.drupal.org/node/2423913                 $url = Url::fromUserInput('/' . ltrim($path, '/'));
              }
/** * {@inheritdoc} */
  public function hasPath() {
    return FALSE;
  }

  /** * {@inheritdoc} */
  public function usesLinkDisplay() {
    return !$this->hasPath();
  }

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

  /** * {@inheritdoc} */

  public function attachTo(array &$build$display_id, Url $feed_url$title) {
    $display = $this->view->displayHandlers->get($display_id);
    $url_options = [];
    $input = $this->view->getExposedInput();
    if ($input) {
      $url_options['query'] = $input;
    }
    $url_options['absolute'] = TRUE;

    $url = $feed_url->setOptions($url_options)->toString();
    if ($display->hasPath()) {
      if (empty($this->preview)) {
        $build['#attached']['feed'][] = [$url$title];
      }
    }
    else {
      $this->view->feedIcons[] = [
        '#theme' => 'feed_icon',
        '#url' => $url,
        '#title' => $title,
      ];
    }
  }

      'empty' => [
        'title' => $this->t('Display contents of "No results found"'),
        'method' => 'defaultEmpty',
      ],
      'access denied' => [
        'title' => $this->t('Display "Access Denied"'),
        'method' => 'defaultAccessDenied',
      ],
    ];

    if ($this->view->display_handler->hasPath()) {
      $defaults['not found']['title'] = $this->t('Show "Page not found"');
    }

    if ($which) {
      if (!empty($defaults[$which])) {
        return $defaults[$which];
      }
    }
    else {
      return $defaults;
    }
  }

  protected function createReplaceOp(PackageInterface $package, OperationData $operation_data) {
    if (!$operation_data->hasPath()) {
      throw new \RuntimeException("'path' component required for 'replace' operations.");
    }
    $package_name = $package->getName();
    $package_path = $this->getPackagePath($package);
    $source = ScaffoldFilePath::sourcePath($package_name$package_path$operation_data->destination()$operation_data->path());
    $op = new ReplaceOp($source$operation_data->overwrite());
    return $op;
  }

  /** * Creates an 'append' (or 'prepend') scaffold op. * * @param \Composer\Package\PackageInterface $package * The package that relative paths will be relative from. * @param OperationData $operation_data * The parameter data for this operation object, i.e. the relative 'path'. * * @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface * A scaffold replace operation object. */

  protected function getDisplaysList(EntityInterface $view) {
    $displays = [];

    $executable = $view->getExecutable();
    $executable->initDisplay();
    foreach ($executable->displayHandlers as $display) {
      $rendered_path = FALSE;
      $definition = $display->getPluginDefinition();
      if (!empty($definition['admin'])) {
        if ($display->hasPath()) {
          $path = $display->getPath();
          if ($view->status() && !str_contains($path, '%')) {
            // Wrap this in a try/catch as trying to generate links to some             // routes may throw a NotAcceptableHttpException if they do not             // respond to HTML, such as RESTExports.             try {
              // @todo Views should expect and store a leading /. See:               // https://www.drupal.org/node/2423913               $rendered_path = Link::fromTextAndUrl('/' . $path, Url::fromUserInput('/' . $path))->toString();
            }
            catch (NotAcceptableHttpException $e) {
              
Home | Imprint | This part of the site doesn't use cookies.