You are here

private function AjaxCartHelper::getCartBlock in Ajax Add to Cart 8

Get cart block.

Parameters

object $container: Container object.

Return value

object Return render object.

1 call to AjaxCartHelper::getCartBlock()
AjaxCartHelper::__construct in src/Helper/AjaxCartHelper.php
Private constructor to avoid instantiation.

File

src/Helper/AjaxCartHelper.php, line 72

Class

AjaxCartHelper
Class AjaxCartHelper.

Namespace

Drupal\ajax_add_to_cart\Helper

Code

private function getCartBlock($container = NULL) {
  $blockId = $this
    ->getCartBlockId();
  if ($blockId != FALSE) {
    $block = Block::load($blockId);
    $render = $container
      ->get('entity_type.manager')
      ->getViewBuilder('block')
      ->view($block);
  }
  return isset($render) ? $render : NULL;
}