"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/modules/comment/src/Plugin/views/field/LinkReply.php" (26 Nov 2020, 864 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "LinkReply.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\comment\Plugin\views\field;
    4 
    5 use Drupal\Core\Url;
    6 use Drupal\views\Plugin\views\field\LinkBase;
    7 use Drupal\views\ResultRow;
    8 
    9 /**
   10  * Field handler to present a link to reply to a comment.
   11  *
   12  * @ingroup views_field_handlers
   13  *
   14  * @ViewsField("comment_link_reply")
   15  */
   16 class LinkReply extends LinkBase {
   17 
   18   /**
   19    * {@inheritdoc}
   20    */
   21   protected function getUrlInfo(ResultRow $row) {
   22     /** @var \Drupal\comment\CommentInterface $comment */
   23     $comment = $this->getEntity($row);
   24     return Url::fromRoute('comment.reply', [
   25       'entity_type' => $comment->getCommentedEntityTypeId(),
   26       'entity' => $comment->getCommentedEntityId(),
   27       'field_name' => $comment->getFieldName(),
   28       'pid' => $comment->id(),
   29     ]);
   30   }
   31 
   32   /**
   33    * {@inheritdoc}
   34    */
   35   protected function getDefaultLabel() {
   36     return $this->t('Reply');
   37   }
   38 
   39 }