Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
| HistoryStep | |
0.00% |
0 / 8 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
| getData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setData | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getHash | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLog | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getTime | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\display_builder\Plugin\Field\FieldType; |
| 6 | |
| 7 | use Drupal\Component\Render\FormattableMarkup; |
| 8 | use Drupal\Core\Field\Attribute\FieldType; |
| 9 | use Drupal\Core\Field\MapFieldItemList; |
| 10 | use Drupal\Core\Field\Plugin\Field\FieldType\MapItem; |
| 11 | use Drupal\Core\StringTranslation\TranslatableMarkup; |
| 12 | |
| 13 | /** |
| 14 | * A single step in the instance log history. |
| 15 | */ |
| 16 | #[FieldType( |
| 17 | id: 'step', |
| 18 | label: new TranslatableMarkup('History step'), |
| 19 | no_ui: TRUE, |
| 20 | list_class: MapFieldItemList::class, |
| 21 | )] |
| 22 | class HistoryStep extends MapItem { |
| 23 | |
| 24 | /** |
| 25 | * Get data. |
| 26 | */ |
| 27 | public function getData(): array { |
| 28 | return $this->getValue()['data'] ?? []; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Set data. |
| 33 | */ |
| 34 | public function setData(array $data): void { |
| 35 | $values = $this->getValue(); |
| 36 | $values['data'] = $data; |
| 37 | $this->setValue($values); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Get hash. |
| 42 | */ |
| 43 | public function getHash(): int { |
| 44 | return $this->getValue()['hash']; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Get log. |
| 49 | */ |
| 50 | public function getLog(): FormattableMarkup|string|null { |
| 51 | return $this->getValue()['log']; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Get time. |
| 56 | */ |
| 57 | public function getTime(): int { |
| 58 | return $this->getValue()['time']; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Ger user. |
| 63 | */ |
| 64 | public function getUser(): ?int { |
| 65 | return $this->getValue()['user'] ?? NULL; |
| 66 | } |
| 67 | |
| 68 | } |