Skip to content
Snippets Groups Projects
Commit dcda8292 authored by sagesolutions's avatar sagesolutions
Browse files

added check if user is in route

parent 70711ce2
Branches
Tags
1 merge request!5added check if user is in route
......@@ -200,7 +200,7 @@ display:
group_type: group
admin_label: ''
plugin_id: text_custom
empty: false
empty: true
content: '<a href="/user/{{ arguments.user }}/add-note" class="button button--action button--primary">Add Note</a>'
tokenize: true
footer: { }
......
......@@ -8,6 +8,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\personal_notes\Entity\PersonalNote;
use Drupal\user\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -79,7 +80,7 @@ class PersonalNotesBlock extends BlockBase implements ContainerFactoryPluginInte
*/
public function build(): array {
// User must be logged on to have personal notes.
if (!$this->currentUser->isAnonymous()) {
if (!$this->currentUser->isAnonymous() && $this->routeMatch->getParameter('user') instanceof UserInterface) {
$user = $this->routeMatch->getParameter('user');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment