missing fields bug fix
This commit is contained in:
@ -27,15 +27,15 @@ class PrevNextSite extends BlockBase {
|
||||
if ($node) {
|
||||
$nodetype = $node->getType();
|
||||
if($nodetype === "site"){
|
||||
$num = $node->get('field_numero')->getString();
|
||||
$num = $node->get('field_poid')->getString();
|
||||
$allSites = \Drupal::entityTypeManager()->getStorage('node')
|
||||
->loadByProperties(['type' => 'site', 'status' => 1]);
|
||||
|
||||
|
||||
|
||||
usort($allSites, function($a, $b){
|
||||
$numA = $a->get('field_numero')->getString();
|
||||
$numB = $b->get('field_numero')->getString();
|
||||
$numA = $a->get('field_poid')->getString();
|
||||
$numB = $b->get('field_poid')->getString();
|
||||
if ($numA == $numB) {
|
||||
return 0;
|
||||
}
|
||||
@ -44,7 +44,7 @@ class PrevNextSite extends BlockBase {
|
||||
$prevnode = null;
|
||||
$nextnode = null;
|
||||
foreach($allSites as $index => $site){
|
||||
$n = $site->get('field_numero')->getString();
|
||||
$n = $site->get('field_poid')->getString();
|
||||
if($n === $num){
|
||||
$prevnode = $index - 1 >= 0 ? $allSites[$index - 1] : null;
|
||||
$nextnode = $index + 1 < count($allSites) ? $allSites[$index + 1] : null;
|
||||
|
Reference in New Issue
Block a user