UnapprovedComments.php in Zircon Profile 8.0
File
core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php
View source
<?php
namespace Drupal\comment\Plugin\Menu\LocalTask;
use Drupal\comment\CommentStorageInterface;
use Drupal\Core\Menu\LocalTaskDefault;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
class UnapprovedComments extends LocalTaskDefault implements ContainerFactoryPluginInterface {
use StringTranslationTrait;
protected $commentStorage;
public function __construct(array $configuration, $plugin_id, array $plugin_definition, CommentStorageInterface $comment_storage) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->commentStorage = $comment_storage;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity.manager')
->getStorage('comment'));
}
public function getTitle() {
return $this
->t('Unapproved comments (@count)', array(
'@count' => $this->commentStorage
->getUnapprovedCount(),
));
}
}