You are here

class AtToolLazyBuilders in AT Tool 2.0 1.0.x

Lazy builders for the at_tool.

Hierarchy

Expanded class hierarchy of AtToolLazyBuilders

1 string reference to 'AtToolLazyBuilders'
at_tool.services.yml in ./at_tool.services.yml
at_tool.services.yml
1 service uses AtToolLazyBuilders
at_tool.lazy_builders in ./at_tool.services.yml
Drupal\at_tool\AtToolLazyBuilders

File

src/AtToolLazyBuilders.php, line 13

Namespace

Drupal\at_tool
View source
class AtToolLazyBuilders implements TrustedCallbackInterface {

  /**
   * The request stack.
   *
   * @var \Symfony\Component\HttpFoundation\RequestStack
   */
  protected $requestStack;

  /**
   * The route match.
   *
   * @var \Drupal\Core\Routing\RouteMatchInterface
   */
  protected $routeMatch;

  /**
   * The title resolver.
   *
   * @var \Drupal\Core\Controller\TitleResolverInterface
   */
  protected $titleResolver;

  /**
   * Constructs a new LazyBuilders object.
   *
   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
   *   The request stack.
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The current route match.
   * @param \Drupal\Core\Controller\TitleResolverInterface $title_resolver
   *   The title resolver.
   */
  public function __construct(RequestStack $request_stack, RouteMatchInterface $route_match, TitleResolverInterface $title_resolver) {
    $this->requestStack = $request_stack;
    $this->routeMatch = $route_match;
    $this->titleResolver = $title_resolver;
  }

  /**
   * Return values for the breadcrumb title placeholder.
   *
   * @return array
   *   A renderable array of breadcrumb title.
   */
  public function breadcrumbTitle() {
    $request = $this->requestStack
      ->getCurrentRequest();
    $route = $this->routeMatch
      ->getRouteObject();
    $title = $this->titleResolver
      ->getTitle($request, $route);
    $array = [
      '#theme' => 'page_title__breadcrumb',
      '#title' => $title,
    ];
    return $array;
  }

  /**
   * {@inheritdoc}
   */
  public static function trustedCallbacks() {
    return [
      'breadcrumbTitle',
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AtToolLazyBuilders::$requestStack protected property The request stack.
AtToolLazyBuilders::$routeMatch protected property The route match.
AtToolLazyBuilders::$titleResolver protected property The title resolver.
AtToolLazyBuilders::breadcrumbTitle public function Return values for the breadcrumb title placeholder.
AtToolLazyBuilders::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface::trustedCallbacks
AtToolLazyBuilders::__construct public function Constructs a new LazyBuilders object.
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
TrustedCallbackInterface::TRIGGER_WARNING constant Untrusted callbacks trigger E_USER_WARNING errors.