How do I get the block title from the plugin implementing it? I'm attempting to print the value of the title of the block in a block plugin.

public function build() {
    $build ='
        &lt;div class="header-text"&gt;
            &lt;'.$this-&gt;configuration['header-size-submit'].'&gt;'.$this-&gt;title.'&lt;/'.$this-&gt;configuration['header-size-submit'].'&gt;
        &lt;/div&gt;
            ';
    return array(
        '#type' =&gt; 'text',
        '#markup' =&gt; $build,
        );
}


I attempted to get the value of the title by using

$this-&gt;title


But that did not work.
If your block plugin derives from the BlockBase class, BlockBase::label() returns the default title for the block, but the block title is set in BlockBase::buildConfigurationForm().

  $form['label'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; $this-&gt;t('Title'),
    '#maxlength' =&gt; 255,
    '#default_value' =&gt; $this-&gt;label(),
    '#required' =&gt; TRUE,
  );
  $form['label_display'] = array(
    '#type' =&gt; 'checkbox',
    '#title' =&gt; $this-&gt;t('Display title'),
    '#default_value' =&gt; ($this-&gt;configuration['label_display'] === BlockInterface::BLOCK_LABEL_VISIBLE),
    '#return_value' =&gt; BlockInterface::BLOCK_LABEL_VISIBLE,
  );


So, your block class should check if $this-&gt;configuration['label_display'] is set to BlockInterface::BLOCK_LABEL_VISIBLE; if it is, then use $this-&gt;configuration['label'] for the title.

That said, I feel like the code you want to implement is actually not necessary, since the BlockBase class already takes care of showing the block title.