Vinoteca: wine shop on 1C-Bitrix (module, template, components, pages)

This commit is contained in:
jimagie committed 2026-10-22 23:22:27 +05:00
commit 52795535ae
586 files changed
+27619

No files matched your search

@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace Jinove\Vinoteca;
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
class Breadcrumbs
{
public static function show(array $items): void
{
global $APPLICATION;
$APPLICATION->AddChainItem((string)Loc::getMessage("VINO_BREADCRUMBS_HOME"), SITE_DIR);
foreach ($items as $item) {
$link = (string)($item[1] ?? "");
if ($link !== "" && str_starts_with($link, "/") && !str_starts_with($link, SITE_DIR)) {
$link = SITE_DIR . ltrim($link, "/");
}
$APPLICATION->AddChainItem((string)$item[0], $link);
}
$APPLICATION->IncludeComponent("bitrix:breadcrumb", "vinoteca", [
"START_FROM" => "0",
"PATH" => "",
"SITE_ID" => SITE_ID,
], false, ["HIDE_ICONS" => "Y"]);
}
public static function schema(array $chain, string $self): array
{
$last = count($chain) - 1;
$items = [];
foreach ($chain as $i => $item) {
$link = (string)$item["LINK"];
$items[] = [
"@type" => "ListItem",
"position" => $i + 1,
"name" => $item["TITLE"],
"item" => $i < $last && $link !== "" ? Config::host() . $link : $self,
];
}
return [
"@context" => "https://schema.org",
"@type" => "BreadcrumbList",
"@id" => $self . "#breadcrumb",
"itemListElement" => $items,
];
}
}