Skip to content

Commit

Permalink
Add minimum height to block layout data form
Browse files Browse the repository at this point in the history
  • Loading branch information
jimsafley committed Nov 14, 2023
1 parent 45cd1e3 commit 41d7a30
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions application/src/Form/BlockLayoutDataForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions application/src/View/Helper/BlockLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 41d7a30

Please sign in to comment.