LinkApprove.php in Drupal 10
File
core/modules/comment/src/Plugin/views/field/LinkApprove.php
View source
<?php
namespace Drupal\comment\Plugin\views\field;
use Drupal\Core\Url;
use Drupal\views\Plugin\views\field\LinkBase;
use Drupal\views\ResultRow;
class LinkApprove extends LinkBase {
protected function getUrlInfo(ResultRow $row) {
return Url::fromRoute('comment.approve', [
'comment' => $this
->getEntity($row)
->id(),
]);
}
protected function renderLink(ResultRow $row) {
$this->options['alter']['query'] = $this
->getDestinationArray();
return parent::renderLink($row);
}
protected function getDefaultLabel() {
return $this
->t('Approve');
}
}