From 41d7a300a4efafd6a57d7657c44a6d31a434f16e Mon Sep 17 00:00:00 2001 From: Jim Safley Date: Tue, 14 Nov 2023 16:05:12 -0500 Subject: [PATCH] Add minimum height to block layout data form --- application/src/Form/BlockLayoutDataForm.php | 12 ++++++++++++ application/src/View/Helper/BlockLayout.php | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/application/src/Form/BlockLayoutDataForm.php b/application/src/Form/BlockLayoutDataForm.php index ee70d6f79..1f3ea46d8 100644 --- a/application/src/Form/BlockLayoutDataForm.php +++ b/application/src/Form/BlockLayoutDataForm.php @@ -91,6 +91,18 @@ public function init() 'label' => 'Background', ], ]); + $this->add([ + 'name' => 'min_height', + 'type' => 'number', + 'options' => [ + 'label' => 'Minimum height', // @translate + ], + 'attributes' => [ + 'id' => 'block-layout-data-min-height', + 'data-key' => 'min_height', + 'min' => '0', + ], + ]); /** * Modules can add elements to this fieldset using the form.add_elements diff --git a/application/src/View/Helper/BlockLayout.php b/application/src/View/Helper/BlockLayout.php index d929d21fb..31851737c 100644 --- a/application/src/View/Helper/BlockLayout.php +++ b/application/src/View/Helper/BlockLayout.php @@ -217,6 +217,10 @@ public function render(SitePageBlockRepresentation $block) // No background size } } + $minHeight = $block->layoutDataValue('min_height'); + if ($minHeight) { + $inlineStyles[] = sprintf('min-height: %spx', (int) $minHeight); + } $view = $this->getView(); $blockLayout = $this->manager->get($block->layout());