Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 13 |
AdminController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
30 | |
0.00% |
0 / 13 |
create | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
__construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
adminPage | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 7 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\comment\Controller\AdminController. | |
*/ | |
namespace Drupal\comment\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Drupal\Core\Form\FormBuilderInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
/** | |
* Returns responses for comment module administrative routes. | |
*/ | |
class AdminController extends ControllerBase { | |
/** | |
* The form builder. | |
* | |
* @var \Drupal\Core\Form\FormBuilderInterface | |
*/ | |
protected $formBuilder; | |
/** | |
* {@inheritdoc} | |
*/ | |
public static function create(ContainerInterface $container) { | |
return new static( | |
$container->get('form_builder') | |
); | |
} | |
/** | |
* Constructs an AdminController object. | |
* | |
* @param \Drupal\Core\Form\FormBuilderInterface $form_builder | |
* The form builder. | |
*/ | |
public function __construct(FormBuilderInterface $form_builder) { | |
$this->formBuilder = $form_builder; | |
} | |
/** | |
* Presents an administrative comment listing. | |
* | |
* @param \Symfony\Component\HttpFoundation\Request $request | |
* The request of the page. | |
* @param string $type | |
* The type of the overview form ('approval' or 'new') default to 'new'. | |
* | |
* @return array | |
* Then comment multiple delete confirmation form or the comments overview | |
* administration form. | |
*/ | |
public function adminPage(Request $request, $type = 'new') { | |
if ($request->request->get('operation') == 'delete' && $request->request->get('comments')) { | |
return $this->formBuilder->getForm('\Drupal\comment\Form\ConfirmDeleteMultiple', $request); | |
} | |
else { | |
return $this->formBuilder->getForm('\Drupal\comment\Form\CommentAdminOverview', $type); | |
} | |
} | |
} |