Skip to content

Commit

Permalink
Merge pull request #28 from Smile-SA/master
Browse files Browse the repository at this point in the history
merge master into 2.2
  • Loading branch information
Fanny DECLERCK authored Oct 18, 2019
2 parents 9c6a783 + 2a36474 commit 36510e8
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Block/Page/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,34 @@ public function __construct(
$this->cmsPage = $cmsPage;
}

/**
* Prepare layout
*
* @return $this
*/
protected function _prepareLayout()
{
$title = $this->getSearchQueryText();
$this->pageConfig->getTitle()->set($title);
// add Home breadcrumb
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
if ($breadcrumbs) {
$breadcrumbs->addCrumb(
'home',
[
'label' => __('Home'),
'title' => __('Go to Home Page'),
'link' => $this->_storeManager->getStore()->getBaseUrl()
]
)->addCrumb(
'search',
['label' => $title, 'title' => $title]
);
}

return parent::_prepareLayout();
}

/**
* Returns cms page collection.
*
Expand Down Expand Up @@ -117,6 +145,16 @@ public function getPageUrl($pageId)
return $this->cmsPage->getPageUrl($pageId);
}

/**
* Get search query text
*
* @return \Magento\Framework\Phrase
*/
public function getSearchQueryText()
{
return __("Search results for: '%1'", $this->escapeHtml($this->getQueryText()));
}

/**
* Init cms page collection.
*
Expand Down

0 comments on commit 36510e8

Please sign in to comment.