Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 11 |
n/a |
0 / 0 |
n/a |
0 / 0 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
||
| MainPageContentSource | |
0.00% |
0 / 3 |
n/a |
0 / 0 |
n/a |
0 / 0 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
||
| getPropValue | |
0.00% |
0 / 2 |
n/a |
0 / 0 |
n/a |
0 / 0 |
|
0.00% |
0 / 1 |
6 | |||||
| getValue | |
0.00% |
0 / 1 |
n/a |
0 / 0 |
n/a |
0 / 0 |
|
0.00% |
0 / 1 |
2 | |||||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\display_builder_page_layout\Plugin\UiPatterns\Source; |
| 6 | |
| 7 | use Drupal\Core\StringTranslation\TranslatableMarkup; |
| 8 | use Drupal\ui_patterns\Attribute\Source; |
| 9 | use Drupal\ui_patterns\PropTypeInterface; |
| 10 | use Drupal\ui_patterns\SourcePluginBase; |
| 11 | |
| 12 | /** |
| 13 | * Plugin implementation of the source. |
| 14 | * |
| 15 | * Slot is explicitly added to prop_types to allow getPropValue |
| 16 | * to return a renderable array in case of slot prop type. |
| 17 | */ |
| 18 | #[Source( |
| 19 | id: 'main_page_content', |
| 20 | label: new TranslatableMarkup('[Page] Main content'), |
| 21 | description: new TranslatableMarkup('The Drupal `Main page content` block (system_main_block).'), |
| 22 | prop_types: ['slot'], |
| 23 | tags: [], |
| 24 | context_requirements: ['page'], |
| 25 | context_definitions: [] |
| 26 | )] |
| 27 | class MainPageContentSource extends SourcePluginBase { |
| 28 | |
| 29 | /** |
| 30 | * {@inheritdoc} |
| 31 | */ |
| 32 | public function getPropValue(): mixed { |
| 33 | $isSlot = ($this->propDefinition['ui_patterns']['type_definition']->getPluginId() === 'slot'); |
| 34 | |
| 35 | return $isSlot ? [] : ''; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Get the value from settings. |
| 40 | * |
| 41 | * @param \Drupal\ui_patterns\PropTypeInterface|null $prop_type |
| 42 | * The prop type. |
| 43 | */ |
| 44 | public function getValue(?PropTypeInterface $prop_type = NULL): mixed { |
| 45 | return $this->configuration['settings']; |
| 46 | } |
| 47 | |
| 48 | } |
Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not
necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once.
Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.