From dc29e202328d7e61349df9153baf4ef77399073d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20de=20la=20Pen=CC=83a?= Date: Mon, 19 Aug 2024 14:42:47 +0100 Subject: [PATCH] chore: Adds ChangeLog detailing --- src/Resource/Area.php | 17 ++++++++++++++++- src/Resource/Block.php | 23 ++++++++++++++++------- src/Resource/Menu.php | 17 ++++++++++++++++- src/Resource/Page.php | 17 ++++++++++++++++- 4 files changed, 64 insertions(+), 10 deletions(-) diff --git a/src/Resource/Area.php b/src/Resource/Area.php index 5739dece..73cc4e16 100644 --- a/src/Resource/Area.php +++ b/src/Resource/Area.php @@ -9,6 +9,7 @@ namespace Nails\Cms\Resource; +use Nails\Admin\Interfaces\ChangeLog; use Nails\Cms\Constants; use Nails\Cms\Exception\Widget\NotFoundException; use Nails\Cms\Service\Widget; @@ -23,7 +24,7 @@ * * @package Nails\Cms\Resource */ -class Area extends Entity +class Area extends Entity implements ChangeLog { /** @var string */ public $label; @@ -76,4 +77,18 @@ public function render(): string return $sOut; } + + // -------------------------------------------------------------------------- + + public static function getChageLogTypeLabel(): string + { + return 'CMS: Area'; + } + + // -------------------------------------------------------------------------- + + public static function getChageLogTypeUrl(): string + { + return \Nails\Cms\Admin\Controller\Area::url(); + } } diff --git a/src/Resource/Block.php b/src/Resource/Block.php index d7b4f798..7990218e 100644 --- a/src/Resource/Block.php +++ b/src/Resource/Block.php @@ -9,21 +9,16 @@ namespace Nails\Cms\Resource; -use Nails\Cms\Constants; -use Nails\Cms\Exception\Widget\NotFoundException; +use Nails\Admin\Interfaces\ChangeLog; use Nails\Cms\Model; -use Nails\Cms\Service\Widget; -use Nails\Common\Exception\FactoryException; use Nails\Common\Resource\Entity; -use Nails\Environment; -use Nails\Factory; /** * Class Block * * @package Nails\Cms\Resource */ -class Block extends Entity +class Block extends Entity implements ChangeLog { /** @var string */ public $type; @@ -62,4 +57,18 @@ public function render(): string return $this->value ?? ''; } } + + // -------------------------------------------------------------------------- + + public static function getChageLogTypeLabel(): string + { + return 'CMS: Block'; + } + + // -------------------------------------------------------------------------- + + public static function getChageLogTypeUrl(): string + { + return \Nails\Cms\Admin\Controller\Block::url(); + } } diff --git a/src/Resource/Menu.php b/src/Resource/Menu.php index 822eef84..726b152c 100644 --- a/src/Resource/Menu.php +++ b/src/Resource/Menu.php @@ -9,6 +9,7 @@ namespace Nails\Cms\Resource; +use Nails\Admin\Interfaces\ChangeLog; use Nails\Cms\Constants; use Nails\Cms\Resource\Menu\Item; use Nails\Common\Exception\FactoryException; @@ -23,7 +24,7 @@ * * @package Nails\Cms\Resource */ -class Menu extends Entity +class Menu extends Entity implements ChangeLog { /** @var string */ public $slug; @@ -59,4 +60,18 @@ public function items(): ?ExpandableField return $this->items; } + + // -------------------------------------------------------------------------- + + public static function getChageLogTypeLabel(): string + { + return 'CMS: Menu'; + } + + // -------------------------------------------------------------------------- + + public static function getChageLogTypeUrl(): string + { + return \Nails\Cms\Admin\Controller\Menu::url(); + } } diff --git a/src/Resource/Page.php b/src/Resource/Page.php index a1661a54..96c2fcda 100644 --- a/src/Resource/Page.php +++ b/src/Resource/Page.php @@ -9,6 +9,7 @@ namespace Nails\Cms\Resource; +use Nails\Admin\Interfaces\ChangeLog; use Nails\Cms\Constants; use Nails\Cms\Exception\RenderException; use Nails\Cms\Resource\Page\Data; @@ -22,7 +23,7 @@ * * @package Nails\Cms\Resource */ -class Page extends Entity +class Page extends Entity implements ChangeLog { /** @var Data */ public $published; @@ -126,4 +127,18 @@ public function render(bool $bRenderPublished = true): string (array) ($bRenderPublished ? $this->published->template_options : $this->draft->template_options), ); } + + // -------------------------------------------------------------------------- + + public static function getChageLogTypeLabel(): string + { + return 'CMS: Page'; + } + + // -------------------------------------------------------------------------- + + public static function getChageLogTypeUrl(): string + { + return \Nails\Cms\Admin\Controller\Pages::url(); + } }