You are here

protected function CartBlock::buildHeading in Commerce Cart Blocks 8

2 calls to CartBlock::buildHeading()
CartBlock::build in src/Plugin/Block/CartBlock.php
Builds the cart block.
CartButtonBlock::build in src/Plugin/Block/CartButtonBlock.php
Builds the cart block.

File

src/Plugin/Block/CartBlock.php, line 115

Class

CartBlock
Provides a cart block.

Namespace

Drupal\commerce_cart_blocks\Plugin\Block

Code

protected function buildHeading() {
  $displayHeading = $this->configuration['display_heading'];
  $result = [];
  if ($displayHeading) {
    $heading = str_replace([
      '@items',
      '@total',
    ], [
      $this
        ->getCountText(),
      $this
        ->getTotalText(),
    ], $this->configuration['heading_text']);
    $result['#type'] = 'markup';
    $result['#markup'] = $heading;
  }
  return $result;
}