public function NodeAccessTestAutoBubblingController::latest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/node/tests/node_access_test_auto_bubbling/src/Controller/NodeAccessTestAutoBubblingController.php \Drupal\node_access_test_auto_bubbling\Controller\NodeAccessTestAutoBubblingController::latest()
- 9 core/modules/node/tests/node_access_test_auto_bubbling/src/Controller/NodeAccessTestAutoBubblingController.php \Drupal\node_access_test_auto_bubbling\Controller\NodeAccessTestAutoBubblingController::latest()
Lists the three latest published node IDs.
Return value
array A render array.
1 string reference to 'NodeAccessTestAutoBubblingController::latest'
- node_access_test_auto_bubbling.routing.yml in core/
modules/ node/ tests/ node_access_test_auto_bubbling/ node_access_test_auto_bubbling.routing.yml - core/modules/node/tests/node_access_test_auto_bubbling/node_access_test_auto_bubbling.routing.yml
File
- core/
modules/ node/ tests/ node_access_test_auto_bubbling/ src/ Controller/ NodeAccessTestAutoBubblingController.php, line 20
Class
- NodeAccessTestAutoBubblingController
- Returns a node ID listing.
Namespace
Drupal\node_access_test_auto_bubbling\ControllerCode
public function latest() {
$nids = $this
->entityTypeManager()
->getStorage('node')
->getQuery()
->accessCheck(TRUE)
->condition('status', NodeInterface::PUBLISHED)
->sort('created', 'DESC')
->range(0, 3)
->execute();
return [
'#markup' => $this
->t('The three latest nodes are: @nids.', [
'@nids' => implode(', ', $nids),
]),
];
}