protected function SchedulerManager::loadNodes in Scheduler 8
Helper method to load latest revision of each node.
Parameters
array $nids: Array of node ids.
Return value
array Array of loaded nodes.
Throws
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
2 calls to SchedulerManager::loadNodes()
- SchedulerManager::publish in src/
SchedulerManager.php - Publish scheduled nodes.
- SchedulerManager::unpublish in src/
SchedulerManager.php - Unpublish scheduled nodes.
File
- src/
SchedulerManager.php, line 601
Class
- SchedulerManager
- Defines a scheduler manager.
Namespace
Drupal\schedulerCode
protected function loadNodes(array $nids) {
$node_storage = $this->entityTypeManager
->getStorage('node');
$nodes = [];
// Load the latest revision for each node.
foreach ($nids as $nid) {
$node = $node_storage
->load($nid);
$revision_ids = $node_storage
->revisionIds($node);
$vid = end($revision_ids);
$nodes[] = $node_storage
->loadRevision($vid);
}
return $nodes;
}