forbiddenMessage example

'entity_type' => $entity->getEntityTypeId(),
                  'entity' => $entity->id(),
                  'field_name' => $field_name,
                ]);
              }
              else {
                $links['comment-add'] += ['url' => $entity->toUrl()];
              }
            }
            elseif ($this->currentUser->isAnonymous()) {
              $links['comment-forbidden'] = [
                'title' => $this->commentManager->forbiddenMessage($entity$field_name),
              ];
            }
          }
        }
        else {
          // Entity in other view modes: add a "post comment" link if the user           // is allowed to post comments and if this entity is allowing new           // comments.           if ($commenting_status == CommentItemInterface::OPEN) {
            $comment_form_location = $field_definition->getSetting('form_location');
            if ($this->currentUser->hasPermission('post comments')) {
              
'pid' => $entity->id(),
          ]),
        ];
      }
      if (!$entity->isPublished() && $entity->access('approve')) {
        $links['comment-approve'] = [
          'title' => t('Approve'),
          'url' => Url::fromRoute('comment.approve', ['comment' => $entity->id()]),
        ];
      }
      if (empty($links) && $this->currentUser->isAnonymous()) {
        $links['comment-forbidden']['title'] = $this->commentManager->forbiddenMessage($commented_entity$entity->getFieldName());
      }
    }

    // Add translations link for translation-enabled comment bundles.     if ($this->moduleHandler->moduleExists('content_translation') && $this->access($entity)->isAllowed()) {
      $links['comment-translations'] = [
        'title' => t('Translate'),
        'url' => $entity->toUrl('drupal:content-translation-overview'),
      ];
    }

    
Home | Imprint | This part of the site doesn't use cookies.