class Node in Drupal 10
Same name in this branch
- 10 core/modules/node/src/Entity/Node.php \Drupal\node\Entity\Node
- 10 core/modules/node/src/Plugin/views/argument_default/Node.php \Drupal\node\Plugin\views\argument_default\Node
- 10 core/modules/node/src/Plugin/views/wizard/Node.php \Drupal\node\Plugin\views\wizard\Node
- 10 core/modules/node/src/Plugin/views/field/Node.php \Drupal\node\Plugin\views\field\Node
- 10 core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node
- 10 core/modules/node/src/Plugin/migrate/source/d7/Node.php \Drupal\node\Plugin\migrate\source\d7\Node
Same name and namespace in other branches
- 8 core/modules/node/src/Plugin/views/argument_default/Node.php \Drupal\node\Plugin\views\argument_default\Node
- 9 core/modules/node/src/Plugin/views/argument_default/Node.php \Drupal\node\Plugin\views\argument_default\Node
Default argument plugin to extract a node.
Plugin annotation
@ViewsArgumentDefault(
id = "node",
title = @Translation("Content ID from URL")
)
Hierarchy
- class \Drupal\node\Plugin\views\argument_default\Node extends \Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase implements CacheableDependencyInterface
Expanded class hierarchy of Node
1 file declares its use of Node
- TopLevelBook.php in core/
modules/ book/ src/ Plugin/ views/ argument_default/ TopLevelBook.php
24 string references to 'Node'
- CategorizingPluginManagerTraitTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Plugin/ CategorizingPluginManagerTraitTest.php - CategorizingPluginManagerTraitTest::testProcessDefinitionCategory in core/
tests/ Drupal/ Tests/ Core/ Plugin/ CategorizingPluginManagerTraitTest.php - @covers ::processDefinitionCategory
- CategoryAutocompleteTest::providerTestAutocompleteSuggestions in core/
modules/ block/ tests/ src/ Unit/ CategoryAutocompleteTest.php - Data provider for testAutocompleteSuggestions().
- CategoryAutocompleteTest::setUp in core/
modules/ block/ tests/ src/ Unit/ CategoryAutocompleteTest.php - CommentBundlesTest::setUp in core/
modules/ comment/ tests/ src/ Kernel/ CommentBundlesTest.php
File
- core/
modules/ node/ src/ Plugin/ views/ argument_default/ Node.php, line 20
Namespace
Drupal\node\Plugin\views\argument_defaultView source
class Node extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
/**
* The route match.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected $routeMatch;
/**
* Constructs a new Node instance.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteMatchInterface $route_match) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->routeMatch = $route_match;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('current_route_match'));
}
/**
* {@inheritdoc}
*/
public function getArgument() {
if (($node = $this->routeMatch
->getParameter('node')) && $node instanceof NodeInterface) {
return $node
->id();
}
}
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
/**
* {@inheritdoc}
*/
public function getCacheContexts() {
return [
'url',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyInterface:: |
public | function | The cache tags associated with this object. | 14 |
Node:: |
protected | property | The route match. | |
Node:: |
public static | function | 1 | |
Node:: |
public | function | 1 | |
Node:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyInterface:: |
|
Node:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyInterface:: |
|
Node:: |
public | function | Constructs a new Node instance. | 1 |