class LinkApprove

Same name and namespace in other branches
  1. 11.x core/modules/comment/src/Plugin/views/field/LinkApprove.php \Drupal\comment\Plugin\views\field\LinkApprove
  2. 10 core/modules/comment/src/Plugin/views/field/LinkApprove.php \Drupal\comment\Plugin\views\field\LinkApprove
  3. 8.9.x core/modules/comment/src/Plugin/views/field/LinkApprove.php \Drupal\comment\Plugin\views\field\LinkApprove

Provides a comment approve link.

Plugin annotation

@ViewsField("comment_link_approve");

Hierarchy

Expanded class hierarchy of LinkApprove

Related topics

File

core/modules/comment/src/Plugin/views/field/LinkApprove.php, line 16

Namespace

Drupal\comment\Plugin\views\field
View source
class LinkApprove extends LinkBase {
  
  /**
   * {@inheritdoc}
   */
  protected function getUrlInfo(ResultRow $row) {
    return Url::fromRoute('comment.approve', [
      'comment' => $this->getEntity($row)
        ->id(),
    ]);
  }
  
  /**
   * {@inheritdoc}
   */
  protected function renderLink(ResultRow $row) {
    $this->options['alter']['query'] = $this->getDestinationArray();
    return parent::renderLink($row);
  }
  
  /**
   * {@inheritdoc}
   */
  protected function getDefaultLabel() {
    return $this->t('Approve');
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.