diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php index e1eca53..91b44c9 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php @@ -10,6 +10,8 @@ use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; +use Drupal\user\UserInterface; +use Drupal\node\NodeInterface; /** * Default argument plugin to extract a user via menu_get_object. @@ -87,13 +89,17 @@ public function getArgument() { // If there is a user object in the current route. if ($this->request->attributes->has('user')) { $user = $this->request->attributes->get('user'); - return $user->id(); + if ($user instanceof UserInterface) { + return $user->id(); + } } // If option to use node author; and node in current route. if (!empty($this->options['user']) && $this->request->attributes->has('node')) { $node = $this->request->attributes->get('node'); - return $node->getAuthorId(); + if ($node instanceof NodeInterface) { + return $node->getAuthorId(); + } } // If the current page is a view that takes uid as an argument.