You are here

protected function Library::extractEntityFromRoute in Layout builder library 8

Extracts an entity from the route values.

Parameters

mixed $value: The raw value from the route.

array $defaults: The route defaults array.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity for the route, or NULL if none exist.

1 call to Library::extractEntityFromRoute()
Library::deriveContextsFromRoute in src/Plugin/SectionStorage/Library.php
Derives the available plugin contexts from route values.

File

src/Plugin/SectionStorage/Library.php, line 221

Class

Library
Defines a class for library based layout storage.

Namespace

Drupal\layout_library\Plugin\SectionStorage

Code

protected function extractEntityFromRoute($value, array $defaults) {
  return $this->entityTypeManager
    ->getStorage('layout')
    ->load($value ?: $defaults['layout']);
}