Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 7 |
LinkApprove | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 7 |
getUrlInfo | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
renderLink | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
getDefaultLabel | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\comment\Plugin\views\field\LinkApprove. | |
*/ | |
namespace Drupal\comment\Plugin\views\field; | |
use Drupal\Core\Url; | |
use Drupal\views\Plugin\views\field\LinkBase; | |
use Drupal\views\ResultRow; | |
/** | |
* Provides a comment approve link. | |
* | |
* @ingroup views_field_handlers | |
* | |
* @ViewsField("comment_link_approve") | |
*/ | |
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'); | |
} | |
} |