Skip to content

Latest commit

 

History

History
656 lines (493 loc) · 17.9 KB

BreadcrumbsHelper.md

File metadata and controls

656 lines (493 loc) · 17.9 KB

BumbleDocGen / Technical description of the project / Renderer / Documentation structure and breadcrumbs / BreadcrumbsHelper


namespace BumbleDocGen\Core\Renderer\Breadcrumbs;

final class BreadcrumbsHelper
Helper entity for working with breadcrumbs

Initialization methods:

  1. __construct

Methods:

  1. getAllPageLinks
  2. getBreadcrumbs - Get breadcrumbs as an array
  3. getBreadcrumbsForTemplates
  4. getNearestIndexFile
  5. getPageDataByKey
  6. getPageDocFileByKey
  7. getPageLinkByKey
  8. getTemplateLinkKey
  9. getTemplateTitle - Get the name of a template by its URL.
  10. renderBreadcrumbs - Returns an HTML string with rendered breadcrumbs

Constants:

Method details:

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

public function getAllPageLinks(): array;

Parameters: not specified

Return value: array

Throws:


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:


public function getBreadcrumbsForTemplates(string $filePatch, bool $fromCurrent = true): array;

Parameters:

Name Type Description
$filePatch string -
$fromCurrent bool -

Return value: array

Throws:


public function getNearestIndexFile(string $templateName): string;

Parameters:

Name Type Description
$templateName string -

Return value: string

Throws:


public function getPageDataByKey(string $key): array|null;

Parameters:

Name Type Description
$key string -

Return value: array | null

Throws:


public function getPageDocFileByKey(string $key): string|null;

Parameters:

Name Type Description
$key string -

Return value: string | null

Throws:


public function getPageLinkByKey(string $key): string|null;

Parameters:

Name Type Description
$key string -

Return value: string | null

Throws:


public function getTemplateLinkKey(string $templateName): string|null;

Parameters:

Name Type Description
$templateName string -

Return value: string | null

Throws:


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

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: