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
|
||||
*/
|
||||
public function getSection(): string
|
||||
public function getSection(): ?Bundle
|
||||
{
|
||||
$parts = preg_split('#/#', $this->path, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
if (count($parts) > 0) {
|
||||
return config(sprintf('sections.%s.title', $parts[0]), $parts[0]);
|
||||
return new Bundle($parts[0], $this->disk);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -123,7 +123,7 @@ public function getArticleTitle(): string
|
|||
|
||||
public function getSiteTitle(): string
|
||||
{
|
||||
return $this->getArticleTitle() . ' - ' . $this->getSection();
|
||||
return $this->getArticleTitle() . ' - ' . $this->getSection()->getArticleTitle();
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
@ -297,14 +297,14 @@ private function fetchBundleTitle(): string
|
|||
if (!empty($date)) {
|
||||
return sprintf(
|
||||
'Lien interne : [%s] %s | Publié le %s',
|
||||
$section,
|
||||
$section->getArticleTitle(),
|
||||
$title,
|
||||
Carbon::parse($date)->format('d/m/Y')
|
||||
);
|
||||
} else {
|
||||
return sprintf(
|
||||
'Lien interne : [%s] %s',
|
||||
$section,
|
||||
$section->getArticleTitle(),
|
||||
$title,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user