public static function Utility::render in Basic cart 8
Same name and namespace in other branches
- 8.6 src/Utility.php \Drupal\basic_cart\Utility::render()
- 8.0 src/Utility.php \Drupal\basic_cart\Utility::render()
- 8.2 src/Utility.php \Drupal\basic_cart\Utility::render()
- 8.3 src/Utility.php \Drupal\basic_cart\Utility::render()
- 8.4 src/Utility.php \Drupal\basic_cart\Utility::render()
- 8.5 src/Utility.php \Drupal\basic_cart\Utility::render()
3 calls to Utility::render()
- CartBlock::build in src/
Plugin/ Block/ CartBlock.php - Builds and returns the renderable array for this block plugin.
- CartController::addToCart in src/
Controller/ CartController.php - CartForm::buildForm in src/
Form/ CartForm.php - Form constructor.
File
- src/
Utility.php, line 236 - Contains \Drupal\basic_cart\Utility
Class
Namespace
Drupal\basic_cartCode
public static function render($template_name = 'basic-cart-cart-template.html.twig', $variable = NULL) {
$twig = \Drupal::service('twig');
$template = $twig
->loadTemplate(drupal_get_path('module', 'basic_cart') . '/templates/' . $template_name);
return $template
->render([
'basic_cart' => $variable ? $variable : self::getCartData(),
]);
}