class NodeAccessTestAutoBubblingController
Same name and namespace in other branches
- 11.x core/modules/node/tests/node_access_test_auto_bubbling/src/Controller/NodeAccessTestAutoBubblingController.php \Drupal\node_access_test_auto_bubbling\Controller\NodeAccessTestAutoBubblingController
Returns a node ID listing.
Hierarchy
- class \Drupal\Core\Controller\ControllerBase extends \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\node_access_test_auto_bubbling\Controller\NodeAccessTestAutoBubblingController extends \Drupal\Core\DependencyInjection\ContainerInjectionInterface implements \Drupal\Core\Controller\ControllerBase
Expanded class hierarchy of NodeAccessTestAutoBubblingController
File
-
core/
modules/ node/ tests/ node_access_test_auto_bubbling/ src/ Controller/ NodeAccessTestAutoBubblingController.php, line 12
Namespace
Drupal\node_access_test_auto_bubbling\ControllerView source
class NodeAccessTestAutoBubblingController extends ControllerBase implements ContainerInjectionInterface {
/**
* Lists the three latest published node IDs.
*
* @return array
* A render array.
*/
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),
]),
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.