45899733e36c22aa2b90be0c5d3679457fe84a3c
[yaffs-website] / web / core / lib / Drupal / Core / Block / Plugin / Block / PageTitleBlock.php
1 <?php
2
3 namespace Drupal\Core\Block\Plugin\Block;
4
5 use Drupal\Core\Block\BlockBase;
6 use Drupal\Core\Block\TitleBlockPluginInterface;
7
8 /**
9  * Provides a block to display the page title.
10  *
11  * @Block(
12  *   id = "page_title_block",
13  *   admin_label = @Translation("Page title"),
14  * )
15  */
16 class PageTitleBlock extends BlockBase implements TitleBlockPluginInterface {
17
18   /**
19    * The page title: a string (plain title) or a render array (formatted title).
20    *
21    * @var string|array
22    */
23   protected $title = '';
24
25   /**
26    * {@inheritdoc}
27    */
28   public function setTitle($title) {
29     $this->title = $title;
30     return $this;
31   }
32
33   /**
34    * {@inheritdoc}
35    */
36   public function defaultConfiguration() {
37     return ['label_display' => FALSE];
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   public function build() {
44     return [
45       '#type' => 'page_title',
46       '#title' => $this->title,
47     ];
48   }
49
50 }