Skip to content

Commit 2dd463c

Browse files
committed
Categories
- Added a way to set a category on the category block
1 parent 68e2f61 commit 2dd463c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Block/Category.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,22 @@ protected function _prepareLayout()
8888
/** @return DataObject */
8989
public function getCategory()
9090
{
91+
if($this->getData('category')) {
92+
return $this->getData('category');
93+
}
9194
return $this->registry->registry('current_category');
9295
}
9396

97+
/**
98+
* @param $category
99+
*
100+
* @return $this
101+
*/
102+
public function setCategory($category) {
103+
$this->setData('category' , $category);
104+
return $this;
105+
}
106+
94107
public function getPosts()
95108
{
96109
if (!$this->posts) {

src/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="Skywire_WordpressApi" setup_version="1.7.1">
3+
<module name="Skywire_WordpressApi" setup_version="1.7.2">
44
</module>
55
</config>

0 commit comments

Comments
 (0)