Skip to content

Commit

Permalink
Fixed issue #37
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorvansach committed Sep 30, 2016
1 parent 41cfdf7 commit 2644884
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Block/Widget/Recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(
public function _toHtml()
{
$this->setTemplate(
$this->getData('template') ?: 'widget/recent.phtml'
$this->getData('custom_template') ?: 'widget/recent.phtml'
);

return parent::_toHtml();
Expand All @@ -79,7 +79,7 @@ public function getTitle()
*/
protected function _preparePostCollection()
{
$size = $this->getData('number_of_posts');
$size = $this->getData('number_of_posts');
if (!$size) {
$size = (int) $this->_scopeConfig->getValue(
'mfblog/sidebar/recent_posts/posts_per_page',
Expand Down Expand Up @@ -141,4 +141,3 @@ public function getShorContent($post)
return $this->_filterProvider->getPageFilter()->filter($content);
}
}

8 changes: 6 additions & 2 deletions etc/widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@
<parameters>
<parameter name="title" xsi:type="text" visible="true" sort_order="10" >
<label translate="true">Title</label>
<description translate="true">Please specify title you want to display on the frontend. You can leave it blank if necessary.</description>
</parameter>
<parameter name="number_of_posts" xsi:type="text" visible="true" sort_order="20" >
<label translate="true">Number of Posts</label>
<description translate="true">Please indicate number of recent posts you want to display. Leave blank to use predefined "Posts Per Page" value.</description>
</parameter>
<parameter name="category_id" xsi:type="select" source_model="Magefan\Blog\Model\Config\Source\Category" visible="true" sort_order="30" >
<label translate="true">Blog Category</label>
<description translate="true">Leave blank to display posts from all categories.</description>
</parameter>
<parameter name="template" xsi:type="text" visible="true" sort_order="40" >
<label translate="true">Template File</label>
<parameter name="custom_template" xsi:type="text" visible="true" sort_order="40" >
<label translate="true">Custom Template</label>
<description translate="true">Leave blank to use default template "Magefan_Blog::widget/recent.phtml".</description>
</parameter>
</parameters>
</widget>
Expand Down

0 comments on commit 2644884

Please sign in to comment.