uc_product_kit.theme.inc in Ubercart 8.4
Same filename and directory in other branches
Theme functions for the uc_product_kit module.
File
uc_product_kit/uc_product_kit.theme.incView source
<?php
/**
* @file
* Theme functions for the uc_product_kit module.
*/
use Drupal\Component\Utility\SafeMarkup;
use Drupal\node\NodeInterface;
use Drupal\node\Entity\Node;
/**
* Renders a product kit component.
*
* @ingroup themeable
*/
function theme_uc_product_kit_list_item(array $variables) {
$product = $variables['product'];
if ($product instanceof NodeInterface) {
$node = Node::load($product
->id());
if ($node
->access('view')) {
$title = $product
->toLink()
->toString();
}
else {
$title = SafeMarkup::checkPlain($product
->label());
}
$qty = $product->qty;
}
else {
$node = $product->nid->entity;
if ($node
->access('view')) {
$title = $node
->toLink($product->title)
->toString();
}
else {
$title = SafeMarkup::checkPlain($product->title);
}
$qty = $product->qty->value;
}
$build = [
'#theme' => 'uc_qty',
'#qty' => $qty,
];
return drupal_render($build) . ' ' . $title;
}
Functions
Name | Description |
---|---|
theme_uc_product_kit_list_item | Renders a product kit component. |