Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
PageTitleSource
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 getPropValue
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getValue
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\display_builder_page_layout\Plugin\UiPatterns\Source;
6
7use Drupal\Core\StringTranslation\TranslatableMarkup;
8use Drupal\ui_patterns\Attribute\Source;
9use Drupal\ui_patterns\PropTypeInterface;
10use 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: 'page_title',
20  label: new TranslatableMarkup('[Page] Title'),
21  description: new TranslatableMarkup('The Drupal `Page title` block (page_title).'),
22  prop_types: ['string'],
23  tags: [],
24  context_requirements: ['page'],
25  context_definitions: []
26)]
27class PageTitleSource extends SourcePluginBase {
28
29  /**
30   * {@inheritdoc}
31   */
32  public function getPropValue(): mixed {
33    return '';
34  }
35
36  /**
37   * Get the value from settings.
38   *
39   * @param \Drupal\ui_patterns\PropTypeInterface|null $prop_type
40   *   The prop type.
41   */
42  public function getValue(?PropTypeInterface $prop_type = NULL): mixed {
43    return $this->configuration['settings'];
44  }
45
46}