class NodePreviewConverter
Same name in this branch
- 11.x core/modules/node/src/ProxyClass/ParamConverter/NodePreviewConverter.php \Drupal\node\ProxyClass\ParamConverter\NodePreviewConverter
Same name in other branches
- 9 core/modules/node/src/ProxyClass/ParamConverter/NodePreviewConverter.php \Drupal\node\ProxyClass\ParamConverter\NodePreviewConverter
- 9 core/modules/node/src/ParamConverter/NodePreviewConverter.php \Drupal\node\ParamConverter\NodePreviewConverter
- 8.9.x core/modules/node/src/ProxyClass/ParamConverter/NodePreviewConverter.php \Drupal\node\ProxyClass\ParamConverter\NodePreviewConverter
- 8.9.x core/modules/node/src/ParamConverter/NodePreviewConverter.php \Drupal\node\ParamConverter\NodePreviewConverter
- 10 core/modules/node/src/ProxyClass/ParamConverter/NodePreviewConverter.php \Drupal\node\ProxyClass\ParamConverter\NodePreviewConverter
- 10 core/modules/node/src/ParamConverter/NodePreviewConverter.php \Drupal\node\ParamConverter\NodePreviewConverter
Provides upcasting for a node entity in preview.
Hierarchy
- class \Drupal\node\ParamConverter\NodePreviewConverter implements \Drupal\Core\ParamConverter\ParamConverterInterface
Expanded class hierarchy of NodePreviewConverter
1 string reference to 'NodePreviewConverter'
- node.services.yml in core/
modules/ node/ node.services.yml - core/modules/node/node.services.yml
1 service uses NodePreviewConverter
- node_preview in core/
modules/ node/ node.services.yml - Drupal\node\ParamConverter\NodePreviewConverter
File
-
core/
modules/ node/ src/ ParamConverter/ NodePreviewConverter.php, line 12
Namespace
Drupal\node\ParamConverterView source
class NodePreviewConverter implements ParamConverterInterface {
/**
* Stores the tempstore factory.
*
* @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
/**
* Constructs a new NodePreviewConverter.
*
* @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The factory for the temp store object.
*/
public function __construct(PrivateTempStoreFactory $temp_store_factory) {
$this->tempStoreFactory = $temp_store_factory;
}
/**
* {@inheritdoc}
*/
public function convert($value, $definition, $name, array $defaults) {
$store = $this->tempStoreFactory
->get('node_preview');
if ($form_state = $store->get($value)) {
return $form_state->getFormObject()
->getEntity();
}
}
/**
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
if (!empty($definition['type']) && $definition['type'] == 'node_preview') {
return TRUE;
}
return FALSE;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
NodePreviewConverter::$tempStoreFactory | protected | property | Stores the tempstore factory. | |
NodePreviewConverter::applies | public | function | Overrides ParamConverterInterface::applies | |
NodePreviewConverter::convert | public | function | Overrides ParamConverterInterface::convert | |
NodePreviewConverter::__construct | public | function | Constructs a new NodePreviewConverter. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.