Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 21 |
| RoleListBuilder | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
42 | |
0.00% |
0 / 21 |
| getFormId | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| buildHeader | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
| buildRow | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
| getDefaultOperations | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 10 |
|||
| submitForm | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\user\RoleListBuilder. | |
| */ | |
| namespace Drupal\user; | |
| use Drupal\Core\Config\Entity\DraggableListBuilder; | |
| use Drupal\Core\Entity\EntityInterface; | |
| use Drupal\Core\Form\FormStateInterface; | |
| /** | |
| * Defines a class to build a listing of user role entities. | |
| * | |
| * @see \Drupal\user\Entity\Role | |
| */ | |
| class RoleListBuilder extends DraggableListBuilder { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getFormId() { | |
| return 'user_admin_roles_form'; | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function buildHeader() { | |
| $header['label'] = t('Name'); | |
| return $header + parent::buildHeader(); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function buildRow(EntityInterface $entity) { | |
| $row['label'] = $entity->label(); | |
| return $row + parent::buildRow($entity); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getDefaultOperations(EntityInterface $entity) { | |
| $operations = parent::getDefaultOperations($entity); | |
| if ($entity->hasLinkTemplate('edit-permissions-form')) { | |
| $operations['permissions'] = array( | |
| 'title' => t('Edit permissions'), | |
| 'weight' => 20, | |
| 'url' => $entity->urlInfo('edit-permissions-form'), | |
| ); | |
| } | |
| return $operations; | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function submitForm(array &$form, FormStateInterface $form_state) { | |
| parent::submitForm($form, $form_state); | |
| drupal_set_message(t('The role settings have been updated.')); | |
| } | |
| } |