Updated to Drupal 8.5. Core Media not yet in use.
[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  *   forms = {
15  *     "settings_tray" = FALSE,
16  *   },
17  * )
18  */
19 class PageTitleBlock extends BlockBase implements TitleBlockPluginInterface {
20
21   /**
22    * The page title: a string (plain title) or a render array (formatted title).
23    *
24    * @var string|array
25    */
26   protected $title = '';
27
28   /**
29    * {@inheritdoc}
30    */
31   public function setTitle($title) {
32     $this->title = $title;
33     return $this;
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function defaultConfiguration() {
40     return ['label_display' => FALSE];
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function build() {
47     return [
48       '#type' => 'page_title',
49       '#title' => $this->title,
50     ];
51   }
52
53 }