BumbleDocGen / Technical description of the project / Renderer / Documentation structure and breadcrumbs / BreadcrumbsHelper
BreadcrumbsHelper class:
namespace BumbleDocGen\Core\Renderer\Breadcrumbs;
final class BreadcrumbsHelper
Helper entity for working with breadcrumbs
- getAllPageLinks
- getBreadcrumbs - Get breadcrumbs as an array
- getBreadcrumbsForTemplates
- getNearestIndexFile
- getPageDataByKey
- getPageDocFileByKey
- getPageLinkByKey
- getTemplateLinkKey
- getTemplateTitle - Get the name of a template by its URL.
- renderBreadcrumbs - Returns an HTML string with rendered breadcrumbs
- #
DEFAULT_PREV_PAGE_NAME_TEMPLATE
| source code
- # __construct | source code
public function __construct(\BumbleDocGen\Core\Configuration\Configuration $configuration, \BumbleDocGen\Core\Cache\LocalCache\LocalObjectCache $localObjectCache, \BumbleDocGen\Core\Renderer\Breadcrumbs\BreadcrumbsTwigEnvironment $breadcrumbsTwig, \BumbleDocGen\Core\Plugin\PluginEventDispatcher $pluginEventDispatcher, string $prevPageNameTemplate = self::DEFAULT_PREV_PAGE_NAME_TEMPLATE);
Parameters:
Name | Type | Description |
---|---|---|
$configuration | \BumbleDocGen\Core\Configuration\Configuration | - |
$localObjectCache | \BumbleDocGen\Core\Cache\LocalCache\LocalObjectCache | - |
$breadcrumbsTwig | \BumbleDocGen\Core\Renderer\Breadcrumbs\BreadcrumbsTwigEnvironment | - |
$pluginEventDispatcher | \BumbleDocGen\Core\Plugin\PluginEventDispatcher | - |
$prevPageNameTemplate | string | Index page for each child section |
- # getAllPageLinks | source code
public function getAllPageLinks(): array;
Parameters: not specified
Return value: array
Throws:
- # getBreadcrumbs | source code
public function getBreadcrumbs(string $filePatch, bool $fromCurrent = true): array;
Get breadcrumbs as an array
Parameters:
Name | Type | Description |
---|---|---|
$filePatch | string | - |
$fromCurrent | bool | - |
Return value: array
Throws:
- # getBreadcrumbsForTemplates | source code
public function getBreadcrumbsForTemplates(string $filePatch, bool $fromCurrent = true): array;
Parameters:
Name | Type | Description |
---|---|---|
$filePatch | string | - |
$fromCurrent | bool | - |
Return value: array
Throws:
- # getNearestIndexFile | source code
public function getNearestIndexFile(string $templateName): string;
Parameters:
Name | Type | Description |
---|---|---|
$templateName | string | - |
Return value: string
Throws:
- # getPageDataByKey | source code
public function getPageDataByKey(string $key): array|null;
Parameters:
Name | Type | Description |
---|---|---|
$key | string | - |
Throws:
- # getPageDocFileByKey | source code
public function getPageDocFileByKey(string $key): string|null;
Parameters:
Name | Type | Description |
---|---|---|
$key | string | - |
Throws:
- # getPageLinkByKey | source code
public function getPageLinkByKey(string $key): string|null;
Parameters:
Name | Type | Description |
---|---|---|
$key | string | - |
Throws:
- # getTemplateLinkKey | source code
public function getTemplateLinkKey(string $templateName): string|null;
Parameters:
Name | Type | Description |
---|---|---|
$templateName | string | - |
Throws:
- # getTemplateTitle | source code
public function getTemplateTitle(string $templateName): string;
Get the name of a template by its URL.
Parameters:
Name | Type | Description |
---|---|---|
$templateName | string | - |
Return value: string
Throws:
Examples of using:
// variable in template:
// {% set title = 'Some template title' %}
$breadcrumbsHelper->getTemplateTitle() == 'Some template title'; // is true
- # renderBreadcrumbs | source code
public function renderBreadcrumbs(string $currentPageTitle, string $filePatch, bool $fromCurrent = true): string;
Returns an HTML string with rendered breadcrumbs
Parameters:
Name | Type | Description |
---|---|---|
$currentPageTitle | string | - |
$filePatch | string | - |
$fromCurrent | bool | - |
Return value: string
Throws: