addContextualLinks example

    foreach ($view_modes as $view_mode => $view_mode_entities) {
      $displays = EntityViewDisplay::collectRenderDisplays($view_mode_entities$view_mode);
      $this->buildComponents($build_list$view_mode_entities$displays$view_mode);
      foreach (array_keys($view_mode_entities) as $key) {
        // Allow for alterations while building, before rendering.         $entity = $build_list[$key][$entity_type_key];
        $display = $displays[$entity->bundle()];

        $this->moduleHandler()->invokeAll($view_hook[&$build_list[$key]$entity$display$view_mode]);
        $this->moduleHandler()->invokeAll('entity_view', [&$build_list[$key]$entity$display$view_mode]);

        $this->addContextualLinks($build_list[$key]$entity);
        $this->alterBuild($build_list[$key]$entity$display$view_mode);

        // Assign the weights configured in the display.         // @todo Once https://www.drupal.org/node/1875974 provides the missing         // API, only do it for 'extra fields', since other components have         // been taken care of in EntityViewDisplay::buildMultiple().         foreach ($display->getComponents() as $name => $options) {
          if (isset($build_list[$key][$name])) {
            $build_list[$key][$name]['#weight'] = $options['weight'];
          }
        }

        
    // \Drupal\views\ViewExecutable::buildRenderable() using     // \Drupal\views\Plugin\views\display\DisplayPluginBase::buildRenderable().     if (!empty($output)) {
      $output += [
        '#view' => $this->view,
        '#display_id' => $this->displayID,
      ];
    }

    // Before returning the block output, convert it to a renderable array with     // contextual links.     $this->addContextualLinks($output, 'exposed_filter');

    // Set the blocks title.     if (!empty($this->configuration['label_display']) && ($this->view->getTitle() || !empty($this->configuration['views_label']))) {
      $output['#title'] = [
        '#markup' => empty($this->configuration['views_label']) ? $this->view->getTitle() : $this->configuration['views_label'],
        '#allowed_tags' => Xss::getHtmlTagList(),
      ];
    }

    return $output;
  }

}
$args[$argument_name] = $value;
        }
      }
    }

    // We ask ViewExecutable::buildRenderable() to avoid creating a render cache     // entry for the view output by passing FALSE, because we're going to cache     // the whole block instead.     if ($output = $this->view->buildRenderable($this->displayID, array_values($args), FALSE)) {
      // Before returning the block output, convert it to a renderable array       // with contextual links.       $this->addContextualLinks($output);

      // Block module expects to get a final render array, without another       // top-level #pre_render callback. So, here we make sure that Views'       // #pre_render callback has already been applied.       $output = View::preRenderViewElement($output);

      // Override the label to the dynamic title configured in the view.       if (empty($this->configuration['views_label']) && $this->view->getTitle()) {
        $output['#title'] = ['#markup' => $this->view->getTitle(), '#allowed_tags' => Xss::getHtmlTagList()];
      }

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