Skip to content

Commit

Permalink
Merge pull request #327 from mageplaza/2.3-develop
Browse files Browse the repository at this point in the history
2.3-develop
  • Loading branch information
Shinichi69 authored Nov 17, 2021
2 parents cec2d9c + 6ae6307 commit cd68940
Show file tree
Hide file tree
Showing 3 changed files with 215 additions and 198 deletions.
12 changes: 8 additions & 4 deletions Block/Category/Listpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

namespace Mageplaza\Blog\Block\Category;

use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Phrase;
use Mageplaza\Blog\Helper\Data;
use Mageplaza\Blog\Model\ResourceModel\Post\Collection;

Expand All @@ -38,7 +40,8 @@ class Listpost extends \Mageplaza\Blog\Block\Listpost
/**
* Override this function to apply collection for each type
*
* @return Collection
* @return Collection|null
* @throws NoSuchEntityException
*/
protected function getCollection()
{
Expand Down Expand Up @@ -76,10 +79,11 @@ protected function _prepareLayout()

if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) {
$category = $this->getBlogObject();
$categoryName = preg_replace('/[^A-Za-z0-9\-]/', ' ', $category->getName());
if ($category) {
$breadcrumbs->addCrumb($category->getUrlKey(), [
'label' => __('Category'),
'title' => __('Category')
'label' => __($categoryName),
'title' => __($categoryName)
]);
}
}
Expand All @@ -88,7 +92,7 @@ protected function _prepareLayout()
/**
* @param bool $meta
*
* @return array
* @return array|Phrase|string
*/
public function getBlogTitle($meta = false)
{
Expand Down
Loading

0 comments on commit cd68940

Please sign in to comment.