diff --git a/assets/source/3.0/js/admin/flexibleHeader/helpers/defaultEditValues.ts b/assets/source/3.0/js/admin/flexibleHeader/helpers/defaultEditValues.ts
index 8cd34b1cd..310fda14e 100644
--- a/assets/source/3.0/js/admin/flexibleHeader/helpers/defaultEditValues.ts
+++ b/assets/source/3.0/js/admin/flexibleHeader/helpers/defaultEditValues.ts
@@ -1,5 +1,6 @@
import { Settings } from "../interfaces"
export const defaultEditValues: Settings = {
- align: 'right'
+ align: 'right',
+ margin: 'none'
}
\ No newline at end of file
diff --git a/assets/source/3.0/js/admin/flexibleHeader/helpers/html.ts b/assets/source/3.0/js/admin/flexibleHeader/helpers/html.ts
index 876a7e508..b900f81de 100644
--- a/assets/source/3.0/js/admin/flexibleHeader/helpers/html.ts
+++ b/assets/source/3.0/js/admin/flexibleHeader/helpers/html.ts
@@ -16,6 +16,14 @@ export function getDropdownHtml(settings: Settings, translations: any) {
+
+
${translations.margin ?? 'Margin'}
+
`;
diff --git a/library/Controller/Header/Flexible.php b/library/Controller/Header/Flexible.php
index b7df12df8..1afdd68f7 100644
--- a/library/Controller/Header/Flexible.php
+++ b/library/Controller/Header/Flexible.php
@@ -7,6 +7,7 @@
use Municipio\Controller\Header\AlignmentTransformer;
use Municipio\Controller\Header\FlipKeyValueTransformer;
use Municipio\Controller\Header\HeaderVisibilityClasses;
+use Municipio\Controller\Header\MarginTransformer;
/**
* Class Flexible
@@ -21,6 +22,7 @@ class Flexible implements HeaderInterface
private FlipKeyValueTransformer $flipKeyValueTransformer;
private MenuVisibilityTransformer $menuVisibilityTransformerInstance;
private HeaderVisibilityClasses $headerVisibilityClassesInstance;
+ private MarginTransformer $marginTransformerInstance;
private IsResponsiveMenuTransformer $isResponsiveMenu;
private string $headerSettingKey = 'header_sortable_section_';
private string $headerSettingKeyResponsive = 'Responsive';
@@ -39,6 +41,7 @@ public function __construct(private object $customizer)
$this->isResponsiveMenu = new IsResponsiveMenuTransformer();
$this->menuVisibilityTransformerInstance = new MenuVisibilityTransformer();
$this->menuOrderTransformerInstance = new MenuOrderTransformer('@md');
+ $this->marginTransformerInstance = new MarginTransformer($this->getHiddenMenuItemsData());
$this->alignmentTransformerInstance = new AlignmentTransformer($this->getHiddenMenuItemsData());
}
@@ -131,6 +134,7 @@ private function getItems(string $section): array
$items = $this->isResponsiveMenu->transform($items, $this->isResponsive);
$items = $this->menuOrderTransformerInstance->transform($items);
$items = $this->menuVisibilityTransformerInstance->transform($items);
+ $items = $this->marginTransformerInstance->transform($items, $setting);
$items = $this->alignmentTransformerInstance->transform($items, $setting);
return $items;
diff --git a/library/Controller/Header/MarginTransformer.php b/library/Controller/Header/MarginTransformer.php
new file mode 100644
index 000000000..c1c5f6bc6
--- /dev/null
+++ b/library/Controller/Header/MarginTransformer.php
@@ -0,0 +1,72 @@
+ &$classes) {
+ if (!empty($this->data->{$settings}->{$menu}->margin)) {
+ $classes = $this->getMarginClass($classes, $this->data->{$settings}->{$menu}->margin);
+ }
+ }
+
+ return $items;
+ }
+
+ /**
+ * Returns an array of margin classes based on the given margin value.
+ *
+ * @param array $classes The existing classes.
+ * @param string $margin The margin value ('none', 'both', or any other value).
+ * @return array The updated array of classes.
+ */
+ private function getMarginClass(array $classes, string $marginDirection)
+ {
+ if ($marginDirection === 'none') {
+ } elseif ($marginDirection === 'both') {
+ $classes[] = $this->buildMarginUtility('left');
+ $classes[] = $this->buildMarginUtility('right');
+ } else {
+ $classes[] = $this->buildMarginUtility($marginDirection);
+ }
+
+ return $classes;
+ }
+
+ /**
+ * Builds a margin utility class based on the given margin direction.
+ *
+ * @param string $marginDirection The direction of the margin.
+ * @return string The generated margin utility class.
+ */
+ private function buildMarginUtility(string $marginDirection)
+ {
+ return "u-margin__$marginDirection--2";
+ }
+}
diff --git a/library/Theme/Enqueue.php b/library/Theme/Enqueue.php
index 1d3645c00..f9818dc14 100644
--- a/library/Theme/Enqueue.php
+++ b/library/Theme/Enqueue.php
@@ -99,6 +99,11 @@ public function customizeScript()
'hiddenValue' => get_theme_mod('header_sortable_hidden_storage'),
'lang' => [
'alignment' => __('Alignment', 'municipio'),
+ 'margin' => __('Margin', 'municipio'),
+ 'left' => __('Left', 'municipio'),
+ 'right' => __('Right', 'municipio'),
+ 'both' => __('Both', 'municipio'),
+ 'none' => __('None', 'municipio'),
]
]
);