Loading src/Plugin/Block/NextPreviousBlock.php +2 −1 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\node\NodeInterface; /** * Provides a 'Next Previous' block. Loading Loading @@ -125,7 +126,7 @@ class NextPreviousBlock extends BlockBase implements BlockPluginInterface, Conta // Get the created time of the current node. $node = $this->request->attributes->get('node'); if ($node && $node->bundle() == $this->configuration['content_type']) { if ($node instanceof NodeInterface && $node->bundle() == $this->configuration['content_type']) { $current_nid = $node->get('nid')->getValue()[0]['value']; $link['prev'] = $this->generatePrevious($current_nid); $link['next'] = $this->generateNext($current_nid); Loading Loading
src/Plugin/Block/NextPreviousBlock.php +2 −1 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\node\NodeInterface; /** * Provides a 'Next Previous' block. Loading Loading @@ -125,7 +126,7 @@ class NextPreviousBlock extends BlockBase implements BlockPluginInterface, Conta // Get the created time of the current node. $node = $this->request->attributes->get('node'); if ($node && $node->bundle() == $this->configuration['content_type']) { if ($node instanceof NodeInterface && $node->bundle() == $this->configuration['content_type']) { $current_nid = $node->get('nid')->getValue()[0]['value']; $link['prev'] = $this->generatePrevious($current_nid); $link['next'] = $this->generateNext($current_nid); Loading