By claudiu.cristea on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.3.x
Introduced in version:
11.3.0
Issue links:
Description:
node_access_view_all_nodes is deprecated.
its functionality was combined into \Drupal\node\NodeGrantDatabaseStorage::checkAll().
Before
$view_all_nodes = node_access_view_all_nodes();
// Reset the internal cache.
drupal_static_reset('node_access_view_all_nodes');
After
$view_all_nodes = \Drupal::entityTypeManager()->getAccessControlHandler('node')->checkAllGrants($account ?? \Drupal::currentUser())
// Reset the internal cache.
\Drupal::service('node.view_all_nodes_memory_cache')->deleteAll();
Calling drupal_static_reset with node_access_view_all_nodes is also deprecated.
2 constructors also have new arguments:
NodeAccessGrantsCacheContext::__construct() now requires an $entityTypeManager
NodeGrantDatabaseStorage::__construct() now requires a $memoryCache which is the new 'node.view_all_nodes_memory_cache' service.
Impacts:
Module developers
Site templates, recipes and distribution developers