diff --git a/sources/application/UI/Base/Layout/PageContent/PageContent.php b/sources/application/UI/Base/Layout/PageContent/PageContent.php index 79decd56aa..3ef77141a1 100644 --- a/sources/application/UI/Base/Layout/PageContent/PageContent.php +++ b/sources/application/UI/Base/Layout/PageContent/PageContent.php @@ -209,13 +209,23 @@ class PageContent extends UIBlock implements iUIContentBlock { return null; } + /** + * @inheritDoc + * @throws \Exception + */ + public function HasSubBlocks(): bool + { + return !empty($this->GetMainBlocks()); + } + /** * Set the MAIN AREA subBlocks * * @inheritDoc * @return $this|\Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock */ - public function SetSubBlocks(array $aSubBlocks): iUIContentBlock { + public function SetSubBlocks(array $aSubBlocks): iUIContentBlock + { $this->SetMainBlocks($aSubBlocks); return $this; diff --git a/sources/application/UI/Base/Layout/PageContent/PageContentWithSideContent.php b/sources/application/UI/Base/Layout/PageContent/PageContentWithSideContent.php index 9de2a15314..30d7e6b47f 100644 --- a/sources/application/UI/Base/Layout/PageContent/PageContentWithSideContent.php +++ b/sources/application/UI/Base/Layout/PageContent/PageContentWithSideContent.php @@ -109,9 +109,18 @@ class PageContentWithSideContent extends PageContent { * * @return $this */ - public function RemoveSideBlock(string $sBlockId) { + public function RemoveSideBlock(string $sBlockId) + { $this->RemoveBlockFromContentArea(static::ENUM_CONTENT_AREA_SIDE, $sBlockId); return $this; } + + /** + * @inheritDoc + */ + public function HasSubBlocks(): bool + { + return parent::HasSubBlocks() || !empty($this->GetSideBlocks()); + } } \ No newline at end of file diff --git a/sources/application/UI/Base/Layout/UIContentBlock.php b/sources/application/UI/Base/Layout/UIContentBlock.php index 0a7084e0db..ecc8b4ef65 100644 --- a/sources/application/UI/Base/Layout/UIContentBlock.php +++ b/sources/application/UI/Base/Layout/UIContentBlock.php @@ -99,6 +99,14 @@ class UIContentBlock extends UIBlock implements iUIContentBlock return isset($this->aSubBlocks[$sId]) ? $this->aSubBlocks[$sId] : null; } + /** + * @inheritDoc + */ + public function HasSubBlocks(): bool + { + return !empty($this->aSubBlocks); + } + /** * @inheritDoc */ diff --git a/sources/application/UI/Base/Layout/iUIContentBlock.php b/sources/application/UI/Base/Layout/iUIContentBlock.php index cd3d1fbc12..1c0ffce91c 100644 --- a/sources/application/UI/Base/Layout/iUIContentBlock.php +++ b/sources/application/UI/Base/Layout/iUIContentBlock.php @@ -64,6 +64,11 @@ interface iUIContentBlock { */ public function GetSubBlock(string $sId): ?iUIBlock; + /** + * @return bool True if there is at least 1 sub-block + */ + public function HasSubBlocks(): bool; + /** * Return an array of all the sub blocks *