getSection() now returns a bundle instead of a string
This commit is contained in:
parent
0a9a9d0a78
commit
807cd3e318
|
@ -65,12 +65,12 @@ public function getDisk(): FilesystemAdapter
|
||||||
/**
|
/**
|
||||||
* Return the section where this bundle is located
|
* Return the section where this bundle is located
|
||||||
*/
|
*/
|
||||||
public function getSection(): string
|
public function getSection(): ?Bundle
|
||||||
{
|
{
|
||||||
$parts = preg_split('#/#', $this->path, -1, PREG_SPLIT_NO_EMPTY);
|
$parts = preg_split('#/#', $this->path, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
|
||||||
if (count($parts) > 0) {
|
if (count($parts) > 0) {
|
||||||
return config(sprintf('sections.%s.title', $parts[0]), $parts[0]);
|
return new Bundle($parts[0], $this->disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -123,7 +123,7 @@ public function getArticleTitle(): string
|
||||||
|
|
||||||
public function getSiteTitle(): string
|
public function getSiteTitle(): string
|
||||||
{
|
{
|
||||||
return $this->getArticleTitle() . ' - ' . $this->getSection();
|
return $this->getArticleTitle() . ' - ' . $this->getSection()->getArticleTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
|
|
@ -297,14 +297,14 @@ private function fetchBundleTitle(): string
|
||||||
if (!empty($date)) {
|
if (!empty($date)) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'Lien interne : [%s] %s | Publié le %s',
|
'Lien interne : [%s] %s | Publié le %s',
|
||||||
$section,
|
$section->getArticleTitle(),
|
||||||
$title,
|
$title,
|
||||||
Carbon::parse($date)->format('d/m/Y')
|
Carbon::parse($date)->format('d/m/Y')
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'Lien interne : [%s] %s',
|
'Lien interne : [%s] %s',
|
||||||
$section,
|
$section->getArticleTitle(),
|
||||||
$title,
|
$title,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user