Skip to content

Commit

Permalink
Page meta title fix in case breadcrumb section is removed via XML (el…
Browse files Browse the repository at this point in the history
…se expression removed)
  • Loading branch information
latenights committed Apr 20, 2017
1 parent de01e0e commit 231cfc7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/code/Magento/Catalog/Block/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function getTitleSeparator($store = null)
*/
protected function _prepareLayout()
{
$title = [];
if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
$breadcrumbsBlock->addCrumb(
'home',
Expand All @@ -64,7 +65,6 @@ protected function _prepareLayout()
]
);

$title = [];
$path = $this->_catalogData->getBreadcrumbPath();

foreach ($path as $name => $breadcrumb) {
Expand All @@ -73,16 +73,18 @@ protected function _prepareLayout()
}

$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));
} else {
$title = [];
$path = $this->_catalogData->getBreadcrumbPath();

foreach ($path as $name => $breadcrumb) {
$title[] = $breadcrumb['label'];
}
return parent::_prepareLayout();
}

$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));
$path = $this->_catalogData->getBreadcrumbPath();

foreach ($path as $name => $breadcrumb) {
$title[] = $breadcrumb['label'];
}

$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));

return parent::_prepareLayout();
}
}

0 comments on commit 231cfc7

Please sign in to comment.