getHtmlTagList example

parent::execute();

    // And now render the view.     $render = $this->view->render();

    // First execute the view so it's possible to get tokens for the title.     // And the title, which is much easier.     // @todo Figure out how to support custom response objects. Maybe for pages     // it should be dropped.     if (is_array($render)) {
      $render += [
        '#title' => ['#markup' => $this->view->getTitle(), '#allowed_tags' => Xss::getHtmlTagList()],
      ];
    }
    return $render;
  }

  /** * {@inheritdoc} */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);

    

    else {
      $linkText = $revision->access('view label') ? $revision->label() : $this->t('- Restricted access -');
    }

    $url = $revision->hasLinkTemplate('revision') ? $revision->toUrl('revision') : NULL;
    $context['revision'] = $url && $url->access()
      ? Link::fromTextAndUrl($linkText$url)->toString()
      : (string) $linkText;
    $context['message'] = $revision instanceof RevisionLogInterface ? [
      '#markup' => $revision->getRevisionLogMessage(),
      '#allowed_tags' => Xss::getHtmlTagList(),
    ] : '';

    return [
      'data' => [
        '#type' => 'inline_template',
        '#template' => isset($context['username'])
          ? '{% trans %} {{ revision }} by {{ username }}{% endtrans %}{% if message %}<p class="revision-log">{{ message }}</p>{% endif %}'
          : '{% trans %} {{ revision }} {% endtrans %}{% if message %}<p class="revision-log">{{ message }}</p>{% endif %}',
        '#context' => $context,
      ],
    ];
  }
/** * Route title callback. * * @param \Drupal\taxonomy\TermInterface $taxonomy_term * The taxonomy term. * * @return array * The term label as a render array. */
  public function termTitle(TermInterface $taxonomy_term) {
    return ['#markup' => $taxonomy_term->getName(), '#allowed_tags' => Xss::getHtmlTagList()];
  }

}
/** * Route title callback. * * @param \Drupal\system\MenuInterface $menu * The menu entity. * * @return array * The menu label as a render array. */
  public function menuTitle(MenuInterface $menu) {
    return ['#markup' => $menu->label(), '#allowed_tags' => Xss::getHtmlTagList()];
  }

}

    }

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

}
/** * Route title callback. * * @param \Drupal\user\UserInterface $user * The user account. * * @return string|array * The user account name as a render array or an empty string if $user is * NULL. */
  public function userTitle(UserInterface $user = NULL) {
    return $user ? ['#markup' => $user->getDisplayName(), '#allowed_tags' => Xss::getHtmlTagList()] : '';
  }

  /** * Logs the current user out. * * @return \Symfony\Component\HttpFoundation\RedirectResponse * A redirection to home page. */
  public function logout() {
    if ($this->currentUser()->isAuthenticated()) {
      user_logout();
    }
$current_revision_displayed = TRUE;
        }

        $row = [];
        $column = [
          'data' => [
            '#type' => 'inline_template',
            '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}<p class="revision-log">{{ message }}</p>{% endif %}',
            '#context' => [
              'date' => $link,
              'username' => $this->renderer->renderPlain($username),
              'message' => ['#markup' => $revision->revision_log->value, '#allowed_tags' => Xss::getHtmlTagList()],
            ],
          ],
        ];
        // @todo Simplify once https://www.drupal.org/node/2334319 lands.         $this->renderer->addCacheableDependency($column['data']$username);
        $row[] = $column;

        if ($is_current_revision) {
          $row[] = [
            'data' => [
              '#prefix' => '<em>',
              
if ($show_info) {
            $rows['query'][] = [
              [
                'data' => [
                  '#type' => 'inline_template',
                  '#template' => "<strong>{% trans 'Title' %}</strong>",
                ],
              ],
              [
                'data' => [
                  '#markup' => $executable->getTitle(),
                  '#allowed_tags' => Xss::getHtmlTagList(),
                ],
              ],
            ];
            if (isset($path)) {
              // @todo Views should expect and store a leading /. See:               // https://www.drupal.org/node/2423913               $path = Link::fromTextAndUrl($path->toString()$path)->toString();
            }
            else {
              $path = t('This display has no path.');
            }
            
// 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()];
      }

      // When view_build is empty, the actual render array output for this View       // is going to be empty. In that case, return just #cache, so that the       // render system knows the reasons (cache contexts & tags) why this Views       // block is empty, and can cache it accordingly.       if (empty($output['view_build'])) {
        $output = ['#cache' => $output['#cache']];
      }

      return $output;
    }
Home | Imprint | This part of the site doesn't use cookies.