function node_is_page
Same name and namespace in other branches
- 10 core/modules/node/node.module \node_is_page()
- 9 core/modules/node/node.module \node_is_page()
- 8.9.x core/modules/node/node.module \node_is_page()
- 7.x modules/node/node.module \node_is_page()
Checks whether the current page is the full page view of the passed-in node.
Parameters
\Drupal\node\NodeInterface $node: A node entity.
Return value
bool TRUE if this is a full page view, otherwise FALSE.
Deprecated
in drupal:11.3.0 and is removed from drupal:13.0.0. There is no replacement, check the view mode instead during rendering.
See also
https://www.drupal.org/node/3458593
File
-
core/
modules/ node/ node.module, line 217
Code
function node_is_page(NodeInterface $node) {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. There is no replacement, check the view mode instead during rendering. See https://www.drupal.org/node/3531945', E_USER_DEPRECATED);
$route_match = \Drupal::routeMatch();
if ($route_match->getRouteName() == 'entity.node.canonical') {
$page_node = $route_match->getParameter('node');
}
return !empty($page_node) ? $page_node->id() == $node->id() : FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.