/**
  * {@inheritdoc}
  */
 public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id)
 {
     $parameters = $route_match->getParameters()->all();
     $entity_type_id = $parameters['entity_type_id'];
     // Attempt to load the content entity.
     if (isset($parameters[$entity_type_id]) && $parameters[$entity_type_id] instanceof ContentEntityInterface) {
         $this->contentEntity = $parameters[$entity_type_id];
     }
     return $this->entityLayoutManager->getFromRouteMatch($route_match);
 }
Exemplo n.º 2
0
 /**
  * Get the entity layout object from the route match object.
  *
  * @return EntityLayoutInterface
  */
 protected function getEntityLayoutFromRouteMatch()
 {
     if (!$this->entityLayout) {
         $this->entityLayout = $this->entityLayoutManager->getFromRouteMatch($this->getRouteMatch());
     }
     return $this->entityLayout;
 }
 /**
  * Build block library for a config entity.
  *
  * @param RouteMatch $route_match
  *   The route match object.
  *
  * @return array
  */
 public function configBlockLibrary(RouteMatch $route_match)
 {
     $entity_layout = $this->entityLayoutManager->getFromRouteMatch($route_match);
     return $this->buildBlockLibrary($entity_layout);
 }