class LayoutParagraphsTempstoreParamConverter in Layout Paragraphs 2.0.x
Layout paragraphs tempstore param converter service.
@internal Tagged services are internal.
Hierarchy
- class \Drupal\layout_paragraphs\Routing\LayoutParagraphsTempstoreParamConverter implements ParamConverterInterface
Expanded class hierarchy of LayoutParagraphsTempstoreParamConverter
1 string reference to 'LayoutParagraphsTempstoreParamConverter'
1 service uses LayoutParagraphsTempstoreParamConverter
File
- src/
Routing/ LayoutParagraphsTempstoreParamConverter.php, line 17
Namespace
Drupal\layout_paragraphs\RoutingView source
class LayoutParagraphsTempstoreParamConverter implements ParamConverterInterface {
/**
* The layout paragraphs layout tempstore.
*
* @var \Drupal\layout_paragraphs\LayoutParagraphsLayoutTempstoreRepository
*/
protected $layoutParagraphsLayoutTempstore;
/**
* The Entity Type Manager service.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface;
*/
protected $entityTypeManager;
/**
* Constructs a new LayoutParagraphsEditorTempstoreParamConverter.
*
* @param \Drupal\layout_paragraphs\LayoutParagraphsLayoutTempstoreRepository $layout_paragraphs_layout_tempstore
* The layout tempstore repository.
*/
public function __construct(LayoutParagraphsLayoutTempstoreRepository $layout_paragraphs_layout_tempstore, EntityTypeManagerInterface $entity_type_manager) {
$this->layoutParagraphsLayoutTempstore = $layout_paragraphs_layout_tempstore;
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public function convert($value, $definition, $name, array $defaults) {
if (empty($defaults['layout_paragraphs_layout'])) {
return NULL;
}
$key = $defaults['layout_paragraphs_layout'];
return $this->layoutParagraphsLayoutTempstore
->getWithStorageKey($key);
}
/**
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
return !empty($definition['layout_paragraphs_layout_tempstore']);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LayoutParagraphsTempstoreParamConverter:: |
protected | property | The Entity Type Manager service. | |
LayoutParagraphsTempstoreParamConverter:: |
protected | property | The layout paragraphs layout tempstore. | |
LayoutParagraphsTempstoreParamConverter:: |
public | function |
Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface:: |
|
LayoutParagraphsTempstoreParamConverter:: |
public | function |
Converts path variables to their corresponding objects. Overrides ParamConverterInterface:: |
|
LayoutParagraphsTempstoreParamConverter:: |
public | function | Constructs a new LayoutParagraphsEditorTempstoreParamConverter. |