From 5c96d1d9d10a23736c533d2254d9b1992fbbdf16 Mon Sep 17 00:00:00 2001 From: Mate Sitchinava Date: Wed, 11 Jan 2023 15:00:53 +0400 Subject: [PATCH] added display_mode to category response --- src/Controller/Pwa.php | 17 +++++++++++++++++ src/Controller/Router.php | 1 + src/View/Result/Page.php | 21 +++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/Controller/Pwa.php b/src/Controller/Pwa.php index 69b26a5..b7c7e4c 100644 --- a/src/Controller/Pwa.php +++ b/src/Controller/Pwa.php @@ -55,6 +55,11 @@ class Pwa extends Action implements HttpGetActionInterface, HttpPostActionInterf */ protected $name; + /** + * @var string + */ + protected $display_mode; + /** * @var string */ @@ -131,6 +136,16 @@ public function setName(string $name): self return $this; } + /** + * @param string $display_mode + * @return Pwa + */ + public function setDisplayMode(string $display_mode): self + { + $this->display_mode = $display_mode; + return $this; + } + /** * @param string $identifier * @return Pwa @@ -176,6 +191,7 @@ public function __construct( $this->id = ''; $this->sku = ''; $this->name = ''; + $this->display_mode = ''; $this->identifier = ''; $this->description = ''; $this->catalogDefaultSortBy = ''; @@ -197,6 +213,7 @@ public function execute() $resultLayout->setSku($this->sku); $resultLayout->setName($this->name); $resultLayout->setIdentifier($this->identifier); + $resultLayout->setDisplayMode($this->display_mode); $resultLayout->setDescription($this->description); $resultLayout->setCatalogDefaultSortBy($this->catalogDefaultSortBy); try{ diff --git a/src/Controller/Router.php b/src/Controller/Router.php index b1bf0fd..678a196 100644 --- a/src/Controller/Router.php +++ b/src/Controller/Router.php @@ -349,6 +349,7 @@ protected function setResponseCategory($id, ActionInterface $action) $action->setId($category->getId() ?? ''); $action->setName($category->getName() ?? ''); + $action->setDisplayMode($category->getDisplayMode() ?? ''); $action->setDescription($category->getDescription() ?? ''); } catch (NoSuchEntityException $e) { $this->setNotFound($action); diff --git a/src/View/Result/Page.php b/src/View/Result/Page.php index 97cdd30..3baaf72 100644 --- a/src/View/Result/Page.php +++ b/src/View/Result/Page.php @@ -107,6 +107,11 @@ class Page extends ExtendedPage */ protected $name; + /** + * @var string + */ + protected $display_mode; + /** * @var string */ @@ -174,6 +179,7 @@ public function __construct( $this->id = ''; $this->sku = ''; $this->name = ''; + $this->display_mode = ''; $this->identifier = ''; $this->description = ''; $this->catalogDefaultSortBy = ''; @@ -250,6 +256,21 @@ public function getName() return $this->name; } + public function setDisplayMode(string $display_mode) + { + if($this->display_mode === '') { + $this->display_mode = $display_mode; + return $this; + } + + return ''; + } + + public function getDisplayMode() + { + return $this->display_mode; + } + public function setIdentifier(string $identifier) { if($this->identifier === '') {