You are here

class Breadcrumb in Breadcrumb Manager 8

Provides a content reaction that sets a breadcrumb title.

Plugin annotation


@ContextReaction(
  id = "breadcrumb",
  label = @Translation("Breadcrumb")
)

Hierarchy

  • class \Drupal\breadcrumb_manager_context\Plugin\ContextReaction\Breadcrumb extends \Drupal\context\ContextReactionPluginBase

Expanded class hierarchy of Breadcrumb

File

modules/breadcrumb_manager_context/src/Plugin/ContextReaction/Breadcrumb.php, line 16

Namespace

Drupal\breadcrumb_manager_context\Plugin\ContextReaction
View source
class Breadcrumb extends ContextReactionPluginBase {

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return parent::defaultConfiguration() + [
      'breadcrumb' => '',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function summary() {
    return $this
      ->getConfiguration()['breadcrumb'];
  }

  /**
   * {@inheritdoc}
   */
  public function execute(array &$vars = []) {
    return $this
      ->getConfiguration()['breadcrumb'];
  }

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['breadcrumb'] = [
      '#title' => $this
        ->t('Breadcrumb title'),
      '#type' => 'textfield',
      '#description' => $this
        ->t('Provides this text as breadcrumb title for the given page.'),
      '#default_value' => $this
        ->getConfiguration()['breadcrumb'],
    ];
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    $this
      ->setConfiguration([
      'breadcrumb' => $form_state
        ->getValue('breadcrumb'),
    ]);
  }

}

Members