Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
12 / 12 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
AuthorizationProfileListBuilder | |
100.00% |
12 / 12 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
buildHeader | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
buildRow | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Drupal\authorization; |
6 | |
7 | use Drupal\Core\Config\Entity\ConfigEntityListBuilder; |
8 | use Drupal\Core\Entity\EntityInterface; |
9 | |
10 | /** |
11 | * Provides a listing of Authorization profile entities. |
12 | */ |
13 | class AuthorizationProfileListBuilder extends ConfigEntityListBuilder { |
14 | |
15 | /** |
16 | * {@inheritdoc} |
17 | */ |
18 | public function buildHeader(): array { |
19 | $header = []; |
20 | $header['label'] = $this->t('Profile'); |
21 | $header['provider'] = $this->t('Provider'); |
22 | $header['consumer'] = $this->t('Consumer'); |
23 | $header['enabled'] = $this->t('Enabled'); |
24 | |
25 | return $header + parent::buildHeader(); |
26 | } |
27 | |
28 | /** |
29 | * {@inheritdoc} |
30 | */ |
31 | public function buildRow(EntityInterface $entity): array { |
32 | $row = []; |
33 | /** @var \Drupal\authorization\AuthorizationProfileInterface $entity */ |
34 | $row['label'] = $entity->label(); |
35 | // @todo Abstract get[Provider|Consumer]Options() from the form into Entity |
36 | // or as a trait so we can display the label of them here instead of the |
37 | // machine name. |
38 | $row['provider'] = $entity->get('provider'); |
39 | $row['consumer'] = $entity->get('consumer'); |
40 | $row['enabled'] = $entity->get('status') ? 'Yes' : 'No'; |
41 | |
42 | return $row + parent::buildRow($entity); |
43 | } |
44 | |
45 | } |