I want to override a _prepareLayout function of the block module-catalog-search/Block/Result.php .
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();
}
In above function, if I want to change the breadcrumbs name from Home > Search Result to something else.
How can I do it with the help of plugin ?
Best Answer
Easiest solution is that use translations
Translation is simple way with doing less code:
Create a translation file at theme translation folder
and write code
See how use http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/translations/translate_practice.html