Update for "Add a link to the breadcrumbs that retu..."

2c4a9e407f
This commit is contained in:
Visman 2023-07-01 21:59:04 +07:00
parent 2c4a9e407f
commit a9ef39c152
2 changed files with 15 additions and 5 deletions

View file

@ -509,6 +509,7 @@ abstract class Page extends Model
{
$result = [];
$active = true;
$ext = null;
foreach ($crumbs as $crumb) {
// модель
@ -520,7 +521,7 @@ abstract class Page extends Model
$name = ['%s', $name];
}
$result[] = [$crumb, $name, $active];
$result[] = [$crumb, $name, $active, $ext];
$active = null;
$this->titles = $name;
@ -529,7 +530,9 @@ abstract class Page extends Model
}
if ($crumb->linkCrumbExt) {
$result[] = [$crumb->linkCrumbExt, '#', null];
$ext = [$crumb->linkCrumbExt, '#'];
} else {
$ext = null;
}
$crumb = $crumb->parent;
@ -539,18 +542,19 @@ abstract class Page extends Model
);
// ссылка (передана массивом)
} elseif (\is_array($crumb)) {
$result[] = [$crumb[0], $crumb[1], $active];
$result[] = [$crumb[0], $crumb[1], $active, $ext];
$this->titles = $crumb[1];
// строка
} else {
$result[] = [null, (string) $crumb, $active];
$result[] = [null, (string) $crumb, $active, $ext];
$this->titles = (string) $crumb;
}
$active = null;
$ext = null;
}
// главная страница
$result[] = [$this->c->Router->link('Index'), 'Index', $active];
$result[] = [$this->c->Router->link('Index'), 'Index', $active, $ext];
return \array_reverse($result);
}

View file

@ -7,6 +7,9 @@
<a class="f-crumb-a @if ($cur[2]) active" aria-current="page @endif" href="{{ $cur[0]->link }}" itemprop="item">
<span itemprop="name">{!! __($cur[1]) !!}</span>
</a>
@if ($cur[3])
&nbsp;[&nbsp;<a href="{{ $cur[3][0] }}">{{ $cur[3][1] }}</a>&nbsp;]
@endif
<meta itemprop="position" content="{!! @iteration !!}">
</li><!-- endinline -->
@else
@ -18,6 +21,9 @@
@else
<span @if ($cur[2]) class="active" @endif itemprop="name">{!! __($cur[1]) !!}</span>
@endif
@if ($cur[3])
&nbsp;[&nbsp;<a href="{{ $cur[3][0] }}">{{ $cur[3][1] }}</a>&nbsp;]
@endif
<meta itemprop="position" content="{!! @iteration !!}">
</li><!-- endinline -->
@endif