refactor(admin): Migrate AdminAjaxHandler to Clean Architecture
- Move AdminAjaxHandler to Admin/Shared/Infrastructure/Api/Wordpress/ - Create FieldMapperInterface for decentralized field mapping - Create FieldMapperRegistry for module discovery - Create FieldMapperProvider for auto-registration of 12 mappers - Add FieldMappers for all components: - ContactFormFieldMapper (46 fields) - CtaBoxSidebarFieldMapper (32 fields) - CtaLetsTalkFieldMapper - CtaPostFieldMapper - FeaturedImageFieldMapper (15 fields) - FooterFieldMapper (31 fields) - HeroFieldMapper - NavbarFieldMapper - RelatedPostFieldMapper (34 fields) - SocialShareFieldMapper - TableOfContentsFieldMapper - TopNotificationBarFieldMapper (17 fields) - Update functions.php bootstrap with FieldMapperProvider - AdminAjaxHandler reduced from ~700 to 145 lines - Follows SRP, OCP, DIP principles BACKUP BEFORE: Removing CTA A/B Testing legacy system 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\ContactForm\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Contact Form
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class ContactFormFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'contact-form';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'contactFormEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'contactFormShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'contactFormShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'contactFormShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'contactFormSectionTitle' => ['group' => 'content', 'attribute' => 'section_title'],
|
||||||
|
'contactFormSectionDescription' => ['group' => 'content', 'attribute' => 'section_description'],
|
||||||
|
'contactFormSubmitButtonText' => ['group' => 'content', 'attribute' => 'submit_button_text'],
|
||||||
|
'contactFormSubmitButtonIcon' => ['group' => 'content', 'attribute' => 'submit_button_icon'],
|
||||||
|
|
||||||
|
// Contact Info
|
||||||
|
'contactFormShowContactInfo' => ['group' => 'contact_info', 'attribute' => 'show_contact_info'],
|
||||||
|
'contactFormPhoneLabel' => ['group' => 'contact_info', 'attribute' => 'phone_label'],
|
||||||
|
'contactFormPhoneValue' => ['group' => 'contact_info', 'attribute' => 'phone_value'],
|
||||||
|
'contactFormEmailLabel' => ['group' => 'contact_info', 'attribute' => 'email_label'],
|
||||||
|
'contactFormEmailValue' => ['group' => 'contact_info', 'attribute' => 'email_value'],
|
||||||
|
'contactFormLocationLabel' => ['group' => 'contact_info', 'attribute' => 'location_label'],
|
||||||
|
'contactFormLocationValue' => ['group' => 'contact_info', 'attribute' => 'location_value'],
|
||||||
|
|
||||||
|
// Form Labels
|
||||||
|
'contactFormFullnamePlaceholder' => ['group' => 'form_labels', 'attribute' => 'fullname_placeholder'],
|
||||||
|
'contactFormCompanyPlaceholder' => ['group' => 'form_labels', 'attribute' => 'company_placeholder'],
|
||||||
|
'contactFormWhatsappPlaceholder' => ['group' => 'form_labels', 'attribute' => 'whatsapp_placeholder'],
|
||||||
|
'contactFormEmailPlaceholder' => ['group' => 'form_labels', 'attribute' => 'email_placeholder'],
|
||||||
|
'contactFormMessagePlaceholder' => ['group' => 'form_labels', 'attribute' => 'message_placeholder'],
|
||||||
|
|
||||||
|
// Integration
|
||||||
|
'contactFormWebhookUrl' => ['group' => 'integration', 'attribute' => 'webhook_url'],
|
||||||
|
'contactFormWebhookMethod' => ['group' => 'integration', 'attribute' => 'webhook_method'],
|
||||||
|
'contactFormIncludePageUrl' => ['group' => 'integration', 'attribute' => 'include_page_url'],
|
||||||
|
'contactFormIncludeTimestamp' => ['group' => 'integration', 'attribute' => 'include_timestamp'],
|
||||||
|
|
||||||
|
// Messages
|
||||||
|
'contactFormSuccessMessage' => ['group' => 'messages', 'attribute' => 'success_message'],
|
||||||
|
'contactFormErrorMessage' => ['group' => 'messages', 'attribute' => 'error_message'],
|
||||||
|
'contactFormSendingMessage' => ['group' => 'messages', 'attribute' => 'sending_message'],
|
||||||
|
'contactFormValidationRequired' => ['group' => 'messages', 'attribute' => 'validation_required'],
|
||||||
|
'contactFormValidationEmail' => ['group' => 'messages', 'attribute' => 'validation_email'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'contactFormSectionBgColor' => ['group' => 'colors', 'attribute' => 'section_bg_color'],
|
||||||
|
'contactFormTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
||||||
|
'contactFormDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'],
|
||||||
|
'contactFormIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'],
|
||||||
|
'contactFormInfoLabelColor' => ['group' => 'colors', 'attribute' => 'info_label_color'],
|
||||||
|
'contactFormInfoValueColor' => ['group' => 'colors', 'attribute' => 'info_value_color'],
|
||||||
|
'contactFormInputBorderColor' => ['group' => 'colors', 'attribute' => 'input_border_color'],
|
||||||
|
'contactFormInputFocusBorder' => ['group' => 'colors', 'attribute' => 'input_focus_border'],
|
||||||
|
'contactFormButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'],
|
||||||
|
'contactFormButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
|
||||||
|
'contactFormButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'],
|
||||||
|
'contactFormSuccessBgColor' => ['group' => 'colors', 'attribute' => 'success_bg_color'],
|
||||||
|
'contactFormSuccessTextColor' => ['group' => 'colors', 'attribute' => 'success_text_color'],
|
||||||
|
'contactFormErrorBgColor' => ['group' => 'colors', 'attribute' => 'error_bg_color'],
|
||||||
|
'contactFormErrorTextColor' => ['group' => 'colors', 'attribute' => 'error_text_color'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'contactFormSectionPaddingY' => ['group' => 'spacing', 'attribute' => 'section_padding_y'],
|
||||||
|
'contactFormSectionMarginTop' => ['group' => 'spacing', 'attribute' => 'section_margin_top'],
|
||||||
|
'contactFormTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
||||||
|
'contactFormDescriptionMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'],
|
||||||
|
'contactFormFormGap' => ['group' => 'spacing', 'attribute' => 'form_gap'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'contactFormInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'],
|
||||||
|
'contactFormButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
||||||
|
'contactFormButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'],
|
||||||
|
'contactFormTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
||||||
|
'contactFormTextareaRows' => ['group' => 'visual_effects', 'attribute' => 'textarea_rows'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\CtaBoxSidebar\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para CTA Box Sidebar
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*
|
||||||
|
* UBICACION:
|
||||||
|
* - Dentro del modulo CtaBoxSidebar (autocontenido)
|
||||||
|
* - Eliminar modulo = eliminar mapper
|
||||||
|
*/
|
||||||
|
final class CtaBoxSidebarFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'cta-box-sidebar';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'ctaEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'ctaShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'ctaShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'ctaShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'ctaTitle' => ['group' => 'content', 'attribute' => 'title'],
|
||||||
|
'ctaDescription' => ['group' => 'content', 'attribute' => 'description'],
|
||||||
|
'ctaButtonText' => ['group' => 'content', 'attribute' => 'button_text'],
|
||||||
|
'ctaButtonIcon' => ['group' => 'content', 'attribute' => 'button_icon'],
|
||||||
|
'ctaButtonAction' => ['group' => 'content', 'attribute' => 'button_action'],
|
||||||
|
'ctaButtonLink' => ['group' => 'content', 'attribute' => 'button_link'],
|
||||||
|
|
||||||
|
// Behavior
|
||||||
|
'ctaTextAlign' => ['group' => 'behavior', 'attribute' => 'text_align'],
|
||||||
|
|
||||||
|
// Typography
|
||||||
|
'ctaTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
|
||||||
|
'ctaTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
|
||||||
|
'ctaDescFontSize' => ['group' => 'typography', 'attribute' => 'description_font_size'],
|
||||||
|
'ctaButtonFontSize' => ['group' => 'typography', 'attribute' => 'button_font_size'],
|
||||||
|
'ctaButtonFontWeight' => ['group' => 'typography', 'attribute' => 'button_font_weight'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'ctaBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
||||||
|
'ctaTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
||||||
|
'ctaDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'],
|
||||||
|
'ctaButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_background_color'],
|
||||||
|
'ctaButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
|
||||||
|
'ctaButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_background'],
|
||||||
|
'ctaButtonHoverText' => ['group' => 'colors', 'attribute' => 'button_hover_text_color'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'ctaContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'],
|
||||||
|
'ctaTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
||||||
|
'ctaDescMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'],
|
||||||
|
'ctaButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'],
|
||||||
|
'ctaIconMarginRight' => ['group' => 'spacing', 'attribute' => 'icon_margin_right'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'ctaBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
||||||
|
'ctaButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
||||||
|
'ctaBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
||||||
|
'ctaTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\CtaLetsTalk\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para CTA Lets Talk
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class CtaLetsTalkFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'cta-lets-talk';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'ctaLetsTalkEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'ctaLetsTalkShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'ctaLetsTalkShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'ctaLetsTalkShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'ctaLetsTalkButtonText' => ['group' => 'content', 'attribute' => 'button_text'],
|
||||||
|
'ctaLetsTalkShowIcon' => ['group' => 'content', 'attribute' => 'show_icon'],
|
||||||
|
'ctaLetsTalkIconClass' => ['group' => 'content', 'attribute' => 'icon_class'],
|
||||||
|
'ctaLetsTalkModalTarget' => ['group' => 'content', 'attribute' => 'modal_target'],
|
||||||
|
'ctaLetsTalkAriaLabel' => ['group' => 'content', 'attribute' => 'aria_label'],
|
||||||
|
|
||||||
|
// Behavior
|
||||||
|
'ctaLetsTalkEnableModal' => ['group' => 'behavior', 'attribute' => 'enable_modal'],
|
||||||
|
'ctaLetsTalkCustomUrl' => ['group' => 'behavior', 'attribute' => 'custom_url'],
|
||||||
|
'ctaLetsTalkOpenNewTab' => ['group' => 'behavior', 'attribute' => 'open_in_new_tab'],
|
||||||
|
|
||||||
|
// Typography
|
||||||
|
'ctaLetsTalkFontSize' => ['group' => 'typography', 'attribute' => 'font_size'],
|
||||||
|
'ctaLetsTalkFontWeight' => ['group' => 'typography', 'attribute' => 'font_weight'],
|
||||||
|
'ctaLetsTalkTextTransform' => ['group' => 'typography', 'attribute' => 'text_transform'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'ctaLetsTalkBgColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
||||||
|
'ctaLetsTalkBgHoverColor' => ['group' => 'colors', 'attribute' => 'background_hover_color'],
|
||||||
|
'ctaLetsTalkTextColor' => ['group' => 'colors', 'attribute' => 'text_color'],
|
||||||
|
'ctaLetsTalkTextHoverColor' => ['group' => 'colors', 'attribute' => 'text_hover_color'],
|
||||||
|
'ctaLetsTalkBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'ctaLetsTalkPaddingTB' => ['group' => 'spacing', 'attribute' => 'padding_top_bottom'],
|
||||||
|
'ctaLetsTalkPaddingLR' => ['group' => 'spacing', 'attribute' => 'padding_left_right'],
|
||||||
|
'ctaLetsTalkMarginLeft' => ['group' => 'spacing', 'attribute' => 'margin_left'],
|
||||||
|
'ctaLetsTalkIconSpacing' => ['group' => 'spacing', 'attribute' => 'icon_spacing'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'ctaLetsTalkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
||||||
|
'ctaLetsTalkBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'],
|
||||||
|
'ctaLetsTalkBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
||||||
|
'ctaLetsTalkTransition' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\CtaPost\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para CTA Post
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class CtaPostFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'cta-post';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'ctaPostEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'ctaPostShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'ctaPostShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'ctaPostShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'ctaPostTitle' => ['group' => 'content', 'attribute' => 'title'],
|
||||||
|
'ctaPostDescription' => ['group' => 'content', 'attribute' => 'description'],
|
||||||
|
'ctaPostButtonText' => ['group' => 'content', 'attribute' => 'button_text'],
|
||||||
|
'ctaPostButtonUrl' => ['group' => 'content', 'attribute' => 'button_url'],
|
||||||
|
'ctaPostButtonIcon' => ['group' => 'content', 'attribute' => 'button_icon'],
|
||||||
|
|
||||||
|
// Typography
|
||||||
|
'ctaPostTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
|
||||||
|
'ctaPostTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
|
||||||
|
'ctaPostDescriptionFontSize' => ['group' => 'typography', 'attribute' => 'description_font_size'],
|
||||||
|
'ctaPostButtonFontSize' => ['group' => 'typography', 'attribute' => 'button_font_size'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'ctaPostGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'],
|
||||||
|
'ctaPostGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'],
|
||||||
|
'ctaPostTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
||||||
|
'ctaPostDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'],
|
||||||
|
'ctaPostButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'],
|
||||||
|
'ctaPostButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
|
||||||
|
'ctaPostButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'ctaPostContainerMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'],
|
||||||
|
'ctaPostContainerMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'],
|
||||||
|
'ctaPostContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'],
|
||||||
|
'ctaPostTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
||||||
|
'ctaPostButtonIconMargin' => ['group' => 'spacing', 'attribute' => 'button_icon_margin'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'ctaPostBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
||||||
|
'ctaPostGradientAngle' => ['group' => 'visual_effects', 'attribute' => 'gradient_angle'],
|
||||||
|
'ctaPostButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
||||||
|
'ctaPostButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'],
|
||||||
|
'ctaPostTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
||||||
|
'ctaPostBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\FeaturedImage\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Featured Image
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class FeaturedImageFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'featured-image';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'featuredImageEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'featuredImageShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'featuredImageShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'featuredImageShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'featuredImageSize' => ['group' => 'content', 'attribute' => 'image_size'],
|
||||||
|
'featuredImageLazyLoading' => ['group' => 'content', 'attribute' => 'lazy_loading'],
|
||||||
|
'featuredImageLinkToMedia' => ['group' => 'content', 'attribute' => 'link_to_media'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'featuredImageMarginTop' => ['group' => 'spacing', 'attribute' => 'margin_top'],
|
||||||
|
'featuredImageMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'featuredImageBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
||||||
|
'featuredImageBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
||||||
|
'featuredImageHoverEffect' => ['group' => 'visual_effects', 'attribute' => 'hover_effect'],
|
||||||
|
'featuredImageHoverScale' => ['group' => 'visual_effects', 'attribute' => 'hover_scale'],
|
||||||
|
'featuredImageTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\Footer\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Footer
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class FooterFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'footer';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'footerEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'footerShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'footerShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
|
||||||
|
// Widget 1
|
||||||
|
'footerWidget1Visible' => ['group' => 'widget_1', 'attribute' => 'widget_1_visible'],
|
||||||
|
'footerWidget1Title' => ['group' => 'widget_1', 'attribute' => 'widget_1_title'],
|
||||||
|
|
||||||
|
// Widget 2
|
||||||
|
'footerWidget2Visible' => ['group' => 'widget_2', 'attribute' => 'widget_2_visible'],
|
||||||
|
'footerWidget2Title' => ['group' => 'widget_2', 'attribute' => 'widget_2_title'],
|
||||||
|
|
||||||
|
// Widget 3
|
||||||
|
'footerWidget3Visible' => ['group' => 'widget_3', 'attribute' => 'widget_3_visible'],
|
||||||
|
'footerWidget3Title' => ['group' => 'widget_3', 'attribute' => 'widget_3_title'],
|
||||||
|
|
||||||
|
// Newsletter
|
||||||
|
'footerNewsletterVisible' => ['group' => 'newsletter', 'attribute' => 'newsletter_visible'],
|
||||||
|
'footerNewsletterTitle' => ['group' => 'newsletter', 'attribute' => 'newsletter_title'],
|
||||||
|
'footerNewsletterDescription' => ['group' => 'newsletter', 'attribute' => 'newsletter_description'],
|
||||||
|
'footerNewsletterPlaceholder' => ['group' => 'newsletter', 'attribute' => 'newsletter_email_placeholder'],
|
||||||
|
'footerNewsletterButtonText' => ['group' => 'newsletter', 'attribute' => 'newsletter_button_text'],
|
||||||
|
'footerNewsletterWebhookUrl' => ['group' => 'newsletter', 'attribute' => 'newsletter_webhook_url'],
|
||||||
|
'footerNewsletterSuccessMessage' => ['group' => 'newsletter', 'attribute' => 'newsletter_success_message'],
|
||||||
|
'footerNewsletterErrorMessage' => ['group' => 'newsletter', 'attribute' => 'newsletter_error_message'],
|
||||||
|
|
||||||
|
// Footer Bottom
|
||||||
|
'footerCopyrightText' => ['group' => 'footer_bottom', 'attribute' => 'copyright_text'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'footerBgColor' => ['group' => 'colors', 'attribute' => 'bg_color'],
|
||||||
|
'footerTextColor' => ['group' => 'colors', 'attribute' => 'text_color'],
|
||||||
|
'footerTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
||||||
|
'footerLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'],
|
||||||
|
'footerLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'],
|
||||||
|
'footerButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'],
|
||||||
|
'footerButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
|
||||||
|
'footerButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'footerPaddingY' => ['group' => 'spacing', 'attribute' => 'padding_y'],
|
||||||
|
'footerMarginTop' => ['group' => 'spacing', 'attribute' => 'margin_top'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'footerInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'],
|
||||||
|
'footerButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
||||||
|
'footerTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
65
Admin/Hero/Infrastructure/FieldMapping/HeroFieldMapper.php
Normal file
65
Admin/Hero/Infrastructure/FieldMapping/HeroFieldMapper.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\Hero\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Hero Section
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class HeroFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'hero';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'heroEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'heroShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'heroShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'heroShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'heroShowCategories' => ['group' => 'content', 'attribute' => 'show_categories'],
|
||||||
|
'heroShowBadgeIcon' => ['group' => 'content', 'attribute' => 'show_badge_icon'],
|
||||||
|
'heroBadgeIconClass' => ['group' => 'content', 'attribute' => 'badge_icon_class'],
|
||||||
|
'heroTitleTag' => ['group' => 'content', 'attribute' => 'title_tag'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'heroGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'],
|
||||||
|
'heroGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'],
|
||||||
|
'heroTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
||||||
|
'heroBadgeBgColor' => ['group' => 'colors', 'attribute' => 'badge_bg_color'],
|
||||||
|
'heroBadgeTextColor' => ['group' => 'colors', 'attribute' => 'badge_text_color'],
|
||||||
|
'heroBadgeIconColor' => ['group' => 'colors', 'attribute' => 'badge_icon_color'],
|
||||||
|
'heroBadgeHoverBg' => ['group' => 'colors', 'attribute' => 'badge_hover_bg'],
|
||||||
|
|
||||||
|
// Typography
|
||||||
|
'heroTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
|
||||||
|
'heroTitleFontSizeMobile' => ['group' => 'typography', 'attribute' => 'title_font_size_mobile'],
|
||||||
|
'heroTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
|
||||||
|
'heroTitleLineHeight' => ['group' => 'typography', 'attribute' => 'title_line_height'],
|
||||||
|
'heroBadgeFontSize' => ['group' => 'typography', 'attribute' => 'badge_font_size'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'heroPaddingVertical' => ['group' => 'spacing', 'attribute' => 'padding_vertical'],
|
||||||
|
'heroMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'],
|
||||||
|
'heroBadgePadding' => ['group' => 'spacing', 'attribute' => 'badge_padding'],
|
||||||
|
'heroBadgeBorderRadius' => ['group' => 'spacing', 'attribute' => 'badge_border_radius'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'heroBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
||||||
|
'heroTitleTextShadow' => ['group' => 'visual_effects', 'attribute' => 'title_text_shadow'],
|
||||||
|
'heroBadgeBackdropBlur' => ['group' => 'visual_effects', 'attribute' => 'badge_backdrop_blur'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,699 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace ROITheme\Admin\Infrastructure\Api\Wordpress;
|
|
||||||
|
|
||||||
use ROITheme\Shared\Application\UseCases\SaveComponentSettings\SaveComponentSettingsUseCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler para peticiones AJAX del panel de administración
|
|
||||||
*
|
|
||||||
* Infrastructure - WordPress specific
|
|
||||||
*/
|
|
||||||
final class AdminAjaxHandler
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private readonly ?SaveComponentSettingsUseCase $saveComponentSettingsUseCase = null
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registra los hooks de WordPress para AJAX
|
|
||||||
*/
|
|
||||||
public function register(): void
|
|
||||||
{
|
|
||||||
// Guardar configuración de componente
|
|
||||||
add_action('wp_ajax_roi_save_component_settings', [$this, 'saveComponentSettings']);
|
|
||||||
|
|
||||||
// Restaurar valores por defecto
|
|
||||||
add_action('wp_ajax_roi_reset_component_defaults', [$this, 'resetComponentDefaults']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Guarda la configuración de un componente
|
|
||||||
*/
|
|
||||||
public function saveComponentSettings(): void
|
|
||||||
{
|
|
||||||
// Verificar nonce
|
|
||||||
check_ajax_referer('roi_admin_dashboard', 'nonce');
|
|
||||||
|
|
||||||
// Verificar permisos
|
|
||||||
if (!current_user_can('manage_options')) {
|
|
||||||
wp_send_json_error([
|
|
||||||
'message' => 'No tienes permisos para realizar esta acción.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtener datos
|
|
||||||
$component = sanitize_text_field($_POST['component'] ?? '');
|
|
||||||
$settings = json_decode(stripslashes($_POST['settings'] ?? '{}'), true);
|
|
||||||
|
|
||||||
if (empty($component) || empty($settings)) {
|
|
||||||
wp_send_json_error([
|
|
||||||
'message' => 'Datos incompletos.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mapear IDs de campos a nombres de atributos del schema
|
|
||||||
$fieldMapping = $this->getFieldMapping();
|
|
||||||
$mappedSettings = [];
|
|
||||||
|
|
||||||
foreach ($settings as $fieldId => $value) {
|
|
||||||
// Convertir ID del campo a nombre del atributo
|
|
||||||
if (!isset($fieldMapping[$fieldId])) {
|
|
||||||
continue; // Campo no mapeado, ignorar
|
|
||||||
}
|
|
||||||
|
|
||||||
$mapping = $fieldMapping[$fieldId];
|
|
||||||
$groupName = $mapping['group'];
|
|
||||||
$attributeName = $mapping['attribute'];
|
|
||||||
|
|
||||||
if (!isset($mappedSettings[$groupName])) {
|
|
||||||
$mappedSettings[$groupName] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$mappedSettings[$groupName][$attributeName] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Usar Use Case para guardar
|
|
||||||
if ($this->saveComponentSettingsUseCase !== null) {
|
|
||||||
$updated = $this->saveComponentSettingsUseCase->execute($component, $mappedSettings);
|
|
||||||
|
|
||||||
wp_send_json_success([
|
|
||||||
'message' => sprintf('Se guardaron %d campos correctamente.', $updated)
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
wp_send_json_error([
|
|
||||||
'message' => 'Error: Use Case no disponible.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restaura los valores por defecto de un componente
|
|
||||||
*/
|
|
||||||
public function resetComponentDefaults(): void
|
|
||||||
{
|
|
||||||
// Verificar nonce
|
|
||||||
check_ajax_referer('roi_admin_dashboard', 'nonce');
|
|
||||||
|
|
||||||
// Verificar permisos
|
|
||||||
if (!current_user_can('manage_options')) {
|
|
||||||
wp_send_json_error([
|
|
||||||
'message' => 'No tienes permisos para realizar esta acción.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtener componente
|
|
||||||
$component = sanitize_text_field($_POST['component'] ?? '');
|
|
||||||
|
|
||||||
if (empty($component)) {
|
|
||||||
wp_send_json_error([
|
|
||||||
'message' => 'Componente no especificado.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ruta al schema JSON
|
|
||||||
$schemaPath = get_template_directory() . '/Schemas/' . $component . '.json';
|
|
||||||
|
|
||||||
if (!file_exists($schemaPath)) {
|
|
||||||
wp_send_json_error([
|
|
||||||
'message' => 'Schema del componente no encontrado.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Usar repositorio para restaurar valores
|
|
||||||
if ($this->saveComponentSettingsUseCase !== null) {
|
|
||||||
global $wpdb;
|
|
||||||
$repository = new \ROITheme\Shared\Infrastructure\Persistence\Wordpress\WordPressComponentSettingsRepository($wpdb);
|
|
||||||
$updated = $repository->resetToDefaults($component, $schemaPath);
|
|
||||||
|
|
||||||
wp_send_json_success([
|
|
||||||
'message' => sprintf('Se restauraron %d campos a sus valores por defecto.', $updated)
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
wp_send_json_error([
|
|
||||||
'message' => 'Error: Repositorio no disponible.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mapeo de IDs de campos HTML a nombres de atributos del schema
|
|
||||||
*
|
|
||||||
* @return array<string, array{group: string, attribute: string}>
|
|
||||||
*/
|
|
||||||
private function getFieldMapping(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
// =====================================================
|
|
||||||
// TOP NOTIFICATION BAR
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Activación y Visibilidad
|
|
||||||
'topBarEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'topBarShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'topBarShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'topBarShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Contenido
|
|
||||||
'topBarIconClass' => ['group' => 'content', 'attribute' => 'icon_class'],
|
|
||||||
'topBarLabelText' => ['group' => 'content', 'attribute' => 'label_text'],
|
|
||||||
'topBarMessageText' => ['group' => 'content', 'attribute' => 'message_text'],
|
|
||||||
'topBarLinkText' => ['group' => 'content', 'attribute' => 'link_text'],
|
|
||||||
'topBarLinkUrl' => ['group' => 'content', 'attribute' => 'link_url'],
|
|
||||||
|
|
||||||
// Colores
|
|
||||||
'topBarBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
|
||||||
'topBarTextColor' => ['group' => 'colors', 'attribute' => 'text_color'],
|
|
||||||
'topBarLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'],
|
|
||||||
'topBarIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'],
|
|
||||||
'topBarLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'],
|
|
||||||
'topBarLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'],
|
|
||||||
|
|
||||||
// Espaciado
|
|
||||||
'topBarFontSize' => ['group' => 'spacing', 'attribute' => 'font_size'],
|
|
||||||
'topBarPadding' => ['group' => 'spacing', 'attribute' => 'padding'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// NAVBAR
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'navbarEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'navbarShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'navbarShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'navbarShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
'navbarSticky' => ['group' => 'visibility', 'attribute' => 'sticky_enabled'],
|
|
||||||
|
|
||||||
// Layout
|
|
||||||
'navbarContainerType' => ['group' => 'layout', 'attribute' => 'container_type'],
|
|
||||||
'navbarPaddingVertical' => ['group' => 'layout', 'attribute' => 'padding_vertical'],
|
|
||||||
'navbarZIndex' => ['group' => 'layout', 'attribute' => 'z_index'],
|
|
||||||
|
|
||||||
// Behavior
|
|
||||||
'navbarMenuLocation' => ['group' => 'behavior', 'attribute' => 'menu_location'],
|
|
||||||
'navbarCustomMenuId' => ['group' => 'behavior', 'attribute' => 'custom_menu_id'],
|
|
||||||
'navbarEnableDropdowns' => ['group' => 'behavior', 'attribute' => 'enable_dropdowns'],
|
|
||||||
'navbarMobileBreakpoint' => ['group' => 'behavior', 'attribute' => 'mobile_breakpoint'],
|
|
||||||
|
|
||||||
// Media (Logo/Marca)
|
|
||||||
'navbarShowBrand' => ['group' => 'media', 'attribute' => 'show_brand'],
|
|
||||||
'navbarUseLogo' => ['group' => 'media', 'attribute' => 'use_logo'],
|
|
||||||
'navbarLogoUrl' => ['group' => 'media', 'attribute' => 'logo_url'],
|
|
||||||
'navbarLogoHeight' => ['group' => 'media', 'attribute' => 'logo_height'],
|
|
||||||
'navbarBrandText' => ['group' => 'media', 'attribute' => 'brand_text'],
|
|
||||||
'navbarBrandFontSize' => ['group' => 'media', 'attribute' => 'brand_font_size'],
|
|
||||||
'navbarBrandColor' => ['group' => 'media', 'attribute' => 'brand_color'],
|
|
||||||
'navbarBrandHoverColor' => ['group' => 'media', 'attribute' => 'brand_hover_color'],
|
|
||||||
|
|
||||||
// Links
|
|
||||||
'linksTextColor' => ['group' => 'links', 'attribute' => 'text_color'],
|
|
||||||
'linksHoverColor' => ['group' => 'links', 'attribute' => 'hover_color'],
|
|
||||||
'linksActiveColor' => ['group' => 'links', 'attribute' => 'active_color'],
|
|
||||||
'linksFontSize' => ['group' => 'links', 'attribute' => 'font_size'],
|
|
||||||
'linksFontWeight' => ['group' => 'links', 'attribute' => 'font_weight'],
|
|
||||||
'linksPadding' => ['group' => 'links', 'attribute' => 'padding'],
|
|
||||||
'linksBorderRadius' => ['group' => 'links', 'attribute' => 'border_radius'],
|
|
||||||
'linksShowUnderline' => ['group' => 'links', 'attribute' => 'show_underline_effect'],
|
|
||||||
'linksUnderlineColor' => ['group' => 'links', 'attribute' => 'underline_color'],
|
|
||||||
|
|
||||||
// Visual Effects (Dropdown)
|
|
||||||
'dropdownBgColor' => ['group' => 'visual_effects', 'attribute' => 'background_color'],
|
|
||||||
'dropdownBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
|
||||||
'dropdownShadow' => ['group' => 'visual_effects', 'attribute' => 'shadow'],
|
|
||||||
'dropdownItemColor' => ['group' => 'visual_effects', 'attribute' => 'item_color'],
|
|
||||||
'dropdownItemHoverBg' => ['group' => 'visual_effects', 'attribute' => 'item_hover_background'],
|
|
||||||
'dropdownItemPadding' => ['group' => 'visual_effects', 'attribute' => 'item_padding'],
|
|
||||||
'dropdownMaxHeight' => ['group' => 'visual_effects', 'attribute' => 'dropdown_max_height'],
|
|
||||||
|
|
||||||
// Colors (Navbar styles)
|
|
||||||
'navbarBgColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
|
||||||
'navbarBoxShadow' => ['group' => 'colors', 'attribute' => 'box_shadow'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// CTA LETS TALK
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'ctaLetsTalkEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'ctaLetsTalkShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'ctaLetsTalkShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'ctaLetsTalkShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Content
|
|
||||||
'ctaLetsTalkButtonText' => ['group' => 'content', 'attribute' => 'button_text'],
|
|
||||||
'ctaLetsTalkShowIcon' => ['group' => 'content', 'attribute' => 'show_icon'],
|
|
||||||
'ctaLetsTalkIconClass' => ['group' => 'content', 'attribute' => 'icon_class'],
|
|
||||||
'ctaLetsTalkModalTarget' => ['group' => 'content', 'attribute' => 'modal_target'],
|
|
||||||
'ctaLetsTalkAriaLabel' => ['group' => 'content', 'attribute' => 'aria_label'],
|
|
||||||
|
|
||||||
// Behavior
|
|
||||||
'ctaLetsTalkEnableModal' => ['group' => 'behavior', 'attribute' => 'enable_modal'],
|
|
||||||
'ctaLetsTalkCustomUrl' => ['group' => 'behavior', 'attribute' => 'custom_url'],
|
|
||||||
'ctaLetsTalkOpenNewTab' => ['group' => 'behavior', 'attribute' => 'open_in_new_tab'],
|
|
||||||
|
|
||||||
// Typography
|
|
||||||
'ctaLetsTalkFontSize' => ['group' => 'typography', 'attribute' => 'font_size'],
|
|
||||||
'ctaLetsTalkFontWeight' => ['group' => 'typography', 'attribute' => 'font_weight'],
|
|
||||||
'ctaLetsTalkTextTransform' => ['group' => 'typography', 'attribute' => 'text_transform'],
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
'ctaLetsTalkBgColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
|
||||||
'ctaLetsTalkBgHoverColor' => ['group' => 'colors', 'attribute' => 'background_hover_color'],
|
|
||||||
'ctaLetsTalkTextColor' => ['group' => 'colors', 'attribute' => 'text_color'],
|
|
||||||
'ctaLetsTalkTextHoverColor' => ['group' => 'colors', 'attribute' => 'text_hover_color'],
|
|
||||||
'ctaLetsTalkBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'ctaLetsTalkPaddingTB' => ['group' => 'spacing', 'attribute' => 'padding_top_bottom'],
|
|
||||||
'ctaLetsTalkPaddingLR' => ['group' => 'spacing', 'attribute' => 'padding_left_right'],
|
|
||||||
'ctaLetsTalkMarginLeft' => ['group' => 'spacing', 'attribute' => 'margin_left'],
|
|
||||||
'ctaLetsTalkIconSpacing' => ['group' => 'spacing', 'attribute' => 'icon_spacing'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'ctaLetsTalkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
|
||||||
'ctaLetsTalkBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'],
|
|
||||||
'ctaLetsTalkBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
|
||||||
'ctaLetsTalkTransition' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// HERO SECTION
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'heroEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'heroShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'heroShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'heroShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Content
|
|
||||||
'heroShowCategories' => ['group' => 'content', 'attribute' => 'show_categories'],
|
|
||||||
'heroShowBadgeIcon' => ['group' => 'content', 'attribute' => 'show_badge_icon'],
|
|
||||||
'heroBadgeIconClass' => ['group' => 'content', 'attribute' => 'badge_icon_class'],
|
|
||||||
'heroTitleTag' => ['group' => 'content', 'attribute' => 'title_tag'],
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
'heroGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'],
|
|
||||||
'heroGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'],
|
|
||||||
'heroTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
|
||||||
'heroBadgeBgColor' => ['group' => 'colors', 'attribute' => 'badge_bg_color'],
|
|
||||||
'heroBadgeTextColor' => ['group' => 'colors', 'attribute' => 'badge_text_color'],
|
|
||||||
'heroBadgeIconColor' => ['group' => 'colors', 'attribute' => 'badge_icon_color'],
|
|
||||||
'heroBadgeHoverBg' => ['group' => 'colors', 'attribute' => 'badge_hover_bg'],
|
|
||||||
|
|
||||||
// Typography
|
|
||||||
'heroTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
|
|
||||||
'heroTitleFontSizeMobile' => ['group' => 'typography', 'attribute' => 'title_font_size_mobile'],
|
|
||||||
'heroTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
|
|
||||||
'heroTitleLineHeight' => ['group' => 'typography', 'attribute' => 'title_line_height'],
|
|
||||||
'heroBadgeFontSize' => ['group' => 'typography', 'attribute' => 'badge_font_size'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'heroPaddingVertical' => ['group' => 'spacing', 'attribute' => 'padding_vertical'],
|
|
||||||
'heroMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'],
|
|
||||||
'heroBadgePadding' => ['group' => 'spacing', 'attribute' => 'badge_padding'],
|
|
||||||
'heroBadgeBorderRadius' => ['group' => 'spacing', 'attribute' => 'badge_border_radius'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'heroBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
|
||||||
'heroTitleTextShadow' => ['group' => 'visual_effects', 'attribute' => 'title_text_shadow'],
|
|
||||||
'heroBadgeBackdropBlur' => ['group' => 'visual_effects', 'attribute' => 'badge_backdrop_blur'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// FEATURED IMAGE
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'featuredImageEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'featuredImageShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'featuredImageShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'featuredImageShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Content
|
|
||||||
'featuredImageSize' => ['group' => 'content', 'attribute' => 'image_size'],
|
|
||||||
'featuredImageLazyLoading' => ['group' => 'content', 'attribute' => 'lazy_loading'],
|
|
||||||
'featuredImageLinkToMedia' => ['group' => 'content', 'attribute' => 'link_to_media'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'featuredImageMarginTop' => ['group' => 'spacing', 'attribute' => 'margin_top'],
|
|
||||||
'featuredImageMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'featuredImageBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
|
||||||
'featuredImageBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
|
||||||
'featuredImageHoverEffect' => ['group' => 'visual_effects', 'attribute' => 'hover_effect'],
|
|
||||||
'featuredImageHoverScale' => ['group' => 'visual_effects', 'attribute' => 'hover_scale'],
|
|
||||||
'featuredImageTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// TABLE OF CONTENTS
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'tocEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'tocShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'tocShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'tocShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Content
|
|
||||||
'tocTitle' => ['group' => 'content', 'attribute' => 'title'],
|
|
||||||
'tocAutoGenerate' => ['group' => 'content', 'attribute' => 'auto_generate'],
|
|
||||||
'tocHeadingLevels' => ['group' => 'content', 'attribute' => 'heading_levels'],
|
|
||||||
'tocSmoothScroll' => ['group' => 'content', 'attribute' => 'smooth_scroll'],
|
|
||||||
|
|
||||||
// Typography
|
|
||||||
'tocTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
|
|
||||||
'tocTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
|
|
||||||
'tocLinkFontSize' => ['group' => 'typography', 'attribute' => 'link_font_size'],
|
|
||||||
'tocLinkLineHeight' => ['group' => 'typography', 'attribute' => 'link_line_height'],
|
|
||||||
'tocLevelThreeFontSize' => ['group' => 'typography', 'attribute' => 'level_three_font_size'],
|
|
||||||
'tocLevelFourFontSize' => ['group' => 'typography', 'attribute' => 'level_four_font_size'],
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
'tocBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
|
||||||
'tocBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'],
|
|
||||||
'tocTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
|
||||||
'tocTitleBorderColor' => ['group' => 'colors', 'attribute' => 'title_border_color'],
|
|
||||||
'tocLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'],
|
|
||||||
'tocLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'],
|
|
||||||
'tocLinkHoverBackground' => ['group' => 'colors', 'attribute' => 'link_hover_background'],
|
|
||||||
'tocActiveBorderColor' => ['group' => 'colors', 'attribute' => 'active_border_color'],
|
|
||||||
'tocActiveBackgroundColor' => ['group' => 'colors', 'attribute' => 'active_background_color'],
|
|
||||||
'tocActiveTextColor' => ['group' => 'colors', 'attribute' => 'active_text_color'],
|
|
||||||
'tocScrollbarTrackColor' => ['group' => 'colors', 'attribute' => 'scrollbar_track_color'],
|
|
||||||
'tocScrollbarThumbColor' => ['group' => 'colors', 'attribute' => 'scrollbar_thumb_color'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'tocContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'],
|
|
||||||
'tocMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'],
|
|
||||||
'tocTitlePaddingBottom' => ['group' => 'spacing', 'attribute' => 'title_padding_bottom'],
|
|
||||||
'tocTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
|
||||||
'tocItemMarginBottom' => ['group' => 'spacing', 'attribute' => 'item_margin_bottom'],
|
|
||||||
'tocLinkPadding' => ['group' => 'spacing', 'attribute' => 'link_padding'],
|
|
||||||
'tocLevelThreePaddingLeft' => ['group' => 'spacing', 'attribute' => 'level_three_padding_left'],
|
|
||||||
'tocLevelFourPaddingLeft' => ['group' => 'spacing', 'attribute' => 'level_four_padding_left'],
|
|
||||||
'tocScrollbarWidth' => ['group' => 'spacing', 'attribute' => 'scrollbar_width'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'tocBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
|
||||||
'tocBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
|
||||||
'tocBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'],
|
|
||||||
'tocLinkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'link_border_radius'],
|
|
||||||
'tocActiveBorderLeftWidth' => ['group' => 'visual_effects', 'attribute' => 'active_border_left_width'],
|
|
||||||
'tocTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
|
||||||
'tocScrollbarBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'scrollbar_border_radius'],
|
|
||||||
|
|
||||||
// Behavior
|
|
||||||
'tocIsSticky' => ['group' => 'behavior', 'attribute' => 'is_sticky'],
|
|
||||||
'tocScrollOffset' => ['group' => 'behavior', 'attribute' => 'scroll_offset'],
|
|
||||||
'tocMaxHeight' => ['group' => 'behavior', 'attribute' => 'max_height'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// SOCIAL SHARE
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'socialShareEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'socialShareShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'socialShareShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'socialShareShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Content
|
|
||||||
'socialShareShowLabel' => ['group' => 'content', 'attribute' => 'show_label'],
|
|
||||||
'socialShareLabelText' => ['group' => 'content', 'attribute' => 'label_text'],
|
|
||||||
|
|
||||||
// Networks
|
|
||||||
'socialShareFacebook' => ['group' => 'networks', 'attribute' => 'show_facebook'],
|
|
||||||
'socialShareFacebookUrl' => ['group' => 'networks', 'attribute' => 'facebook_url'],
|
|
||||||
'socialShareInstagram' => ['group' => 'networks', 'attribute' => 'show_instagram'],
|
|
||||||
'socialShareInstagramUrl' => ['group' => 'networks', 'attribute' => 'instagram_url'],
|
|
||||||
'socialShareLinkedin' => ['group' => 'networks', 'attribute' => 'show_linkedin'],
|
|
||||||
'socialShareLinkedinUrl' => ['group' => 'networks', 'attribute' => 'linkedin_url'],
|
|
||||||
'socialShareWhatsapp' => ['group' => 'networks', 'attribute' => 'show_whatsapp'],
|
|
||||||
'socialShareWhatsappNumber' => ['group' => 'networks', 'attribute' => 'whatsapp_number'],
|
|
||||||
'socialShareTwitter' => ['group' => 'networks', 'attribute' => 'show_twitter'],
|
|
||||||
'socialShareTwitterUrl' => ['group' => 'networks', 'attribute' => 'twitter_url'],
|
|
||||||
'socialShareEmail' => ['group' => 'networks', 'attribute' => 'show_email'],
|
|
||||||
'socialShareEmailAddress' => ['group' => 'networks', 'attribute' => 'email_address'],
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
'socialShareLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'],
|
|
||||||
'socialShareBorderTopColor' => ['group' => 'colors', 'attribute' => 'border_top_color'],
|
|
||||||
'socialShareButtonBg' => ['group' => 'colors', 'attribute' => 'button_background'],
|
|
||||||
'socialShareFacebookColor' => ['group' => 'colors', 'attribute' => 'facebook_color'],
|
|
||||||
'socialShareInstagramColor' => ['group' => 'colors', 'attribute' => 'instagram_color'],
|
|
||||||
'socialShareLinkedinColor' => ['group' => 'colors', 'attribute' => 'linkedin_color'],
|
|
||||||
'socialShareWhatsappColor' => ['group' => 'colors', 'attribute' => 'whatsapp_color'],
|
|
||||||
'socialShareTwitterColor' => ['group' => 'colors', 'attribute' => 'twitter_color'],
|
|
||||||
'socialShareEmailColor' => ['group' => 'colors', 'attribute' => 'email_color'],
|
|
||||||
|
|
||||||
// Typography
|
|
||||||
'socialShareLabelFontSize' => ['group' => 'typography', 'attribute' => 'label_font_size'],
|
|
||||||
'socialShareIconFontSize' => ['group' => 'typography', 'attribute' => 'icon_font_size'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'socialShareMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'],
|
|
||||||
'socialShareMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'],
|
|
||||||
'socialSharePaddingTop' => ['group' => 'spacing', 'attribute' => 'container_padding_top'],
|
|
||||||
'socialSharePaddingBottom' => ['group' => 'spacing', 'attribute' => 'container_padding_bottom'],
|
|
||||||
'socialShareLabelMarginBottom' => ['group' => 'spacing', 'attribute' => 'label_margin_bottom'],
|
|
||||||
'socialShareButtonsGap' => ['group' => 'spacing', 'attribute' => 'buttons_gap'],
|
|
||||||
'socialShareButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'socialShareBorderTopWidth' => ['group' => 'visual_effects', 'attribute' => 'border_top_width'],
|
|
||||||
'socialShareButtonBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'button_border_width'],
|
|
||||||
'socialShareButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
|
||||||
'socialShareTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
|
||||||
'socialShareHoverBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'hover_box_shadow'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// CTA POST
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'ctaPostEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'ctaPostShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'ctaPostShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'ctaPostShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Content
|
|
||||||
'ctaPostTitle' => ['group' => 'content', 'attribute' => 'title'],
|
|
||||||
'ctaPostDescription' => ['group' => 'content', 'attribute' => 'description'],
|
|
||||||
'ctaPostButtonText' => ['group' => 'content', 'attribute' => 'button_text'],
|
|
||||||
'ctaPostButtonUrl' => ['group' => 'content', 'attribute' => 'button_url'],
|
|
||||||
'ctaPostButtonIcon' => ['group' => 'content', 'attribute' => 'button_icon'],
|
|
||||||
|
|
||||||
// Typography
|
|
||||||
'ctaPostTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
|
|
||||||
'ctaPostTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
|
|
||||||
'ctaPostDescriptionFontSize' => ['group' => 'typography', 'attribute' => 'description_font_size'],
|
|
||||||
'ctaPostButtonFontSize' => ['group' => 'typography', 'attribute' => 'button_font_size'],
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
'ctaPostGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'],
|
|
||||||
'ctaPostGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'],
|
|
||||||
'ctaPostTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
|
||||||
'ctaPostDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'],
|
|
||||||
'ctaPostButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'],
|
|
||||||
'ctaPostButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
|
|
||||||
'ctaPostButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'ctaPostContainerMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'],
|
|
||||||
'ctaPostContainerMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'],
|
|
||||||
'ctaPostContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'],
|
|
||||||
'ctaPostTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
|
||||||
'ctaPostButtonIconMargin' => ['group' => 'spacing', 'attribute' => 'button_icon_margin'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'ctaPostBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
|
||||||
'ctaPostGradientAngle' => ['group' => 'visual_effects', 'attribute' => 'gradient_angle'],
|
|
||||||
'ctaPostButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
|
||||||
'ctaPostButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'],
|
|
||||||
'ctaPostTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
|
||||||
'ctaPostBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// CONTACT FORM
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'contactFormEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'contactFormShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'contactFormShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'contactFormShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Content
|
|
||||||
'contactFormSectionTitle' => ['group' => 'content', 'attribute' => 'section_title'],
|
|
||||||
'contactFormSectionDescription' => ['group' => 'content', 'attribute' => 'section_description'],
|
|
||||||
'contactFormSubmitButtonText' => ['group' => 'content', 'attribute' => 'submit_button_text'],
|
|
||||||
'contactFormSubmitButtonIcon' => ['group' => 'content', 'attribute' => 'submit_button_icon'],
|
|
||||||
|
|
||||||
// Contact Info
|
|
||||||
'contactFormShowContactInfo' => ['group' => 'contact_info', 'attribute' => 'show_contact_info'],
|
|
||||||
'contactFormPhoneLabel' => ['group' => 'contact_info', 'attribute' => 'phone_label'],
|
|
||||||
'contactFormPhoneValue' => ['group' => 'contact_info', 'attribute' => 'phone_value'],
|
|
||||||
'contactFormEmailLabel' => ['group' => 'contact_info', 'attribute' => 'email_label'],
|
|
||||||
'contactFormEmailValue' => ['group' => 'contact_info', 'attribute' => 'email_value'],
|
|
||||||
'contactFormLocationLabel' => ['group' => 'contact_info', 'attribute' => 'location_label'],
|
|
||||||
'contactFormLocationValue' => ['group' => 'contact_info', 'attribute' => 'location_value'],
|
|
||||||
|
|
||||||
// Form Labels
|
|
||||||
'contactFormFullnamePlaceholder' => ['group' => 'form_labels', 'attribute' => 'fullname_placeholder'],
|
|
||||||
'contactFormCompanyPlaceholder' => ['group' => 'form_labels', 'attribute' => 'company_placeholder'],
|
|
||||||
'contactFormWhatsappPlaceholder' => ['group' => 'form_labels', 'attribute' => 'whatsapp_placeholder'],
|
|
||||||
'contactFormEmailPlaceholder' => ['group' => 'form_labels', 'attribute' => 'email_placeholder'],
|
|
||||||
'contactFormMessagePlaceholder' => ['group' => 'form_labels', 'attribute' => 'message_placeholder'],
|
|
||||||
|
|
||||||
// Integration
|
|
||||||
'contactFormWebhookUrl' => ['group' => 'integration', 'attribute' => 'webhook_url'],
|
|
||||||
'contactFormWebhookMethod' => ['group' => 'integration', 'attribute' => 'webhook_method'],
|
|
||||||
'contactFormIncludePageUrl' => ['group' => 'integration', 'attribute' => 'include_page_url'],
|
|
||||||
'contactFormIncludeTimestamp' => ['group' => 'integration', 'attribute' => 'include_timestamp'],
|
|
||||||
|
|
||||||
// Messages
|
|
||||||
'contactFormSuccessMessage' => ['group' => 'messages', 'attribute' => 'success_message'],
|
|
||||||
'contactFormErrorMessage' => ['group' => 'messages', 'attribute' => 'error_message'],
|
|
||||||
'contactFormSendingMessage' => ['group' => 'messages', 'attribute' => 'sending_message'],
|
|
||||||
'contactFormValidationRequired' => ['group' => 'messages', 'attribute' => 'validation_required'],
|
|
||||||
'contactFormValidationEmail' => ['group' => 'messages', 'attribute' => 'validation_email'],
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
'contactFormSectionBgColor' => ['group' => 'colors', 'attribute' => 'section_bg_color'],
|
|
||||||
'contactFormTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
|
||||||
'contactFormDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'],
|
|
||||||
'contactFormIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'],
|
|
||||||
'contactFormInfoLabelColor' => ['group' => 'colors', 'attribute' => 'info_label_color'],
|
|
||||||
'contactFormInfoValueColor' => ['group' => 'colors', 'attribute' => 'info_value_color'],
|
|
||||||
'contactFormInputBorderColor' => ['group' => 'colors', 'attribute' => 'input_border_color'],
|
|
||||||
'contactFormInputFocusBorder' => ['group' => 'colors', 'attribute' => 'input_focus_border'],
|
|
||||||
'contactFormButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'],
|
|
||||||
'contactFormButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
|
|
||||||
'contactFormButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'],
|
|
||||||
'contactFormSuccessBgColor' => ['group' => 'colors', 'attribute' => 'success_bg_color'],
|
|
||||||
'contactFormSuccessTextColor' => ['group' => 'colors', 'attribute' => 'success_text_color'],
|
|
||||||
'contactFormErrorBgColor' => ['group' => 'colors', 'attribute' => 'error_bg_color'],
|
|
||||||
'contactFormErrorTextColor' => ['group' => 'colors', 'attribute' => 'error_text_color'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'contactFormSectionPaddingY' => ['group' => 'spacing', 'attribute' => 'section_padding_y'],
|
|
||||||
'contactFormSectionMarginTop' => ['group' => 'spacing', 'attribute' => 'section_margin_top'],
|
|
||||||
'contactFormTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
|
||||||
'contactFormDescriptionMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'],
|
|
||||||
'contactFormFormGap' => ['group' => 'spacing', 'attribute' => 'form_gap'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'contactFormInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'],
|
|
||||||
'contactFormButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
|
||||||
'contactFormButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'],
|
|
||||||
'contactFormTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
|
||||||
'contactFormTextareaRows' => ['group' => 'visual_effects', 'attribute' => 'textarea_rows'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// CTA BOX SIDEBAR
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'ctaEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'ctaShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'ctaShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
'ctaShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
|
||||||
|
|
||||||
// Content
|
|
||||||
'ctaTitle' => ['group' => 'content', 'attribute' => 'title'],
|
|
||||||
'ctaDescription' => ['group' => 'content', 'attribute' => 'description'],
|
|
||||||
'ctaButtonText' => ['group' => 'content', 'attribute' => 'button_text'],
|
|
||||||
'ctaButtonIcon' => ['group' => 'content', 'attribute' => 'button_icon'],
|
|
||||||
'ctaButtonAction' => ['group' => 'content', 'attribute' => 'button_action'],
|
|
||||||
'ctaButtonLink' => ['group' => 'content', 'attribute' => 'button_link'],
|
|
||||||
|
|
||||||
// Behavior
|
|
||||||
'ctaTextAlign' => ['group' => 'behavior', 'attribute' => 'text_align'],
|
|
||||||
|
|
||||||
// Typography
|
|
||||||
'ctaTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
|
|
||||||
'ctaTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
|
|
||||||
'ctaDescFontSize' => ['group' => 'typography', 'attribute' => 'description_font_size'],
|
|
||||||
'ctaButtonFontSize' => ['group' => 'typography', 'attribute' => 'button_font_size'],
|
|
||||||
'ctaButtonFontWeight' => ['group' => 'typography', 'attribute' => 'button_font_weight'],
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
'ctaBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
|
||||||
'ctaTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
|
||||||
'ctaDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'],
|
|
||||||
'ctaButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_background_color'],
|
|
||||||
'ctaButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
|
|
||||||
'ctaButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_background'],
|
|
||||||
'ctaButtonHoverText' => ['group' => 'colors', 'attribute' => 'button_hover_text_color'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'ctaContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'],
|
|
||||||
'ctaTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
|
||||||
'ctaDescMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'],
|
|
||||||
'ctaButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'],
|
|
||||||
'ctaIconMarginRight' => ['group' => 'spacing', 'attribute' => 'icon_margin_right'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'ctaBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
|
||||||
'ctaButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
|
||||||
'ctaBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
|
||||||
'ctaTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
|
||||||
|
|
||||||
// =====================================================
|
|
||||||
// FOOTER
|
|
||||||
// =====================================================
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
'footerEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
|
||||||
'footerShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
|
||||||
'footerShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
|
||||||
|
|
||||||
// Widget 1
|
|
||||||
'footerWidget1Visible' => ['group' => 'widget_1', 'attribute' => 'widget_1_visible'],
|
|
||||||
'footerWidget1Title' => ['group' => 'widget_1', 'attribute' => 'widget_1_title'],
|
|
||||||
|
|
||||||
// Widget 2
|
|
||||||
'footerWidget2Visible' => ['group' => 'widget_2', 'attribute' => 'widget_2_visible'],
|
|
||||||
'footerWidget2Title' => ['group' => 'widget_2', 'attribute' => 'widget_2_title'],
|
|
||||||
|
|
||||||
// Widget 3
|
|
||||||
'footerWidget3Visible' => ['group' => 'widget_3', 'attribute' => 'widget_3_visible'],
|
|
||||||
'footerWidget3Title' => ['group' => 'widget_3', 'attribute' => 'widget_3_title'],
|
|
||||||
|
|
||||||
// Newsletter
|
|
||||||
'footerNewsletterVisible' => ['group' => 'newsletter', 'attribute' => 'newsletter_visible'],
|
|
||||||
'footerNewsletterTitle' => ['group' => 'newsletter', 'attribute' => 'newsletter_title'],
|
|
||||||
'footerNewsletterDescription' => ['group' => 'newsletter', 'attribute' => 'newsletter_description'],
|
|
||||||
'footerNewsletterPlaceholder' => ['group' => 'newsletter', 'attribute' => 'newsletter_email_placeholder'],
|
|
||||||
'footerNewsletterButtonText' => ['group' => 'newsletter', 'attribute' => 'newsletter_button_text'],
|
|
||||||
'footerNewsletterWebhookUrl' => ['group' => 'newsletter', 'attribute' => 'newsletter_webhook_url'],
|
|
||||||
'footerNewsletterSuccessMessage' => ['group' => 'newsletter', 'attribute' => 'newsletter_success_message'],
|
|
||||||
'footerNewsletterErrorMessage' => ['group' => 'newsletter', 'attribute' => 'newsletter_error_message'],
|
|
||||||
|
|
||||||
// Footer Bottom
|
|
||||||
'footerCopyrightText' => ['group' => 'footer_bottom', 'attribute' => 'copyright_text'],
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
'footerBgColor' => ['group' => 'colors', 'attribute' => 'bg_color'],
|
|
||||||
'footerTextColor' => ['group' => 'colors', 'attribute' => 'text_color'],
|
|
||||||
'footerTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
|
||||||
'footerLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'],
|
|
||||||
'footerLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'],
|
|
||||||
'footerButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'],
|
|
||||||
'footerButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
|
|
||||||
'footerButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'],
|
|
||||||
|
|
||||||
// Spacing
|
|
||||||
'footerPaddingY' => ['group' => 'spacing', 'attribute' => 'padding_y'],
|
|
||||||
'footerMarginTop' => ['group' => 'spacing', 'attribute' => 'margin_top'],
|
|
||||||
|
|
||||||
// Visual Effects
|
|
||||||
'footerInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'],
|
|
||||||
'footerButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
|
||||||
'footerTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\Navbar\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Navbar
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class NavbarFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'navbar';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'navbarEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'navbarShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'navbarShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'navbarShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
'navbarSticky' => ['group' => 'visibility', 'attribute' => 'sticky_enabled'],
|
||||||
|
|
||||||
|
// Layout
|
||||||
|
'navbarContainerType' => ['group' => 'layout', 'attribute' => 'container_type'],
|
||||||
|
'navbarPaddingVertical' => ['group' => 'layout', 'attribute' => 'padding_vertical'],
|
||||||
|
'navbarZIndex' => ['group' => 'layout', 'attribute' => 'z_index'],
|
||||||
|
|
||||||
|
// Behavior
|
||||||
|
'navbarMenuLocation' => ['group' => 'behavior', 'attribute' => 'menu_location'],
|
||||||
|
'navbarCustomMenuId' => ['group' => 'behavior', 'attribute' => 'custom_menu_id'],
|
||||||
|
'navbarEnableDropdowns' => ['group' => 'behavior', 'attribute' => 'enable_dropdowns'],
|
||||||
|
'navbarMobileBreakpoint' => ['group' => 'behavior', 'attribute' => 'mobile_breakpoint'],
|
||||||
|
|
||||||
|
// Media (Logo/Marca)
|
||||||
|
'navbarShowBrand' => ['group' => 'media', 'attribute' => 'show_brand'],
|
||||||
|
'navbarUseLogo' => ['group' => 'media', 'attribute' => 'use_logo'],
|
||||||
|
'navbarLogoUrl' => ['group' => 'media', 'attribute' => 'logo_url'],
|
||||||
|
'navbarLogoHeight' => ['group' => 'media', 'attribute' => 'logo_height'],
|
||||||
|
'navbarBrandText' => ['group' => 'media', 'attribute' => 'brand_text'],
|
||||||
|
'navbarBrandFontSize' => ['group' => 'media', 'attribute' => 'brand_font_size'],
|
||||||
|
'navbarBrandColor' => ['group' => 'media', 'attribute' => 'brand_color'],
|
||||||
|
'navbarBrandHoverColor' => ['group' => 'media', 'attribute' => 'brand_hover_color'],
|
||||||
|
|
||||||
|
// Links
|
||||||
|
'linksTextColor' => ['group' => 'links', 'attribute' => 'text_color'],
|
||||||
|
'linksHoverColor' => ['group' => 'links', 'attribute' => 'hover_color'],
|
||||||
|
'linksActiveColor' => ['group' => 'links', 'attribute' => 'active_color'],
|
||||||
|
'linksFontSize' => ['group' => 'links', 'attribute' => 'font_size'],
|
||||||
|
'linksFontWeight' => ['group' => 'links', 'attribute' => 'font_weight'],
|
||||||
|
'linksPadding' => ['group' => 'links', 'attribute' => 'padding'],
|
||||||
|
'linksBorderRadius' => ['group' => 'links', 'attribute' => 'border_radius'],
|
||||||
|
'linksShowUnderline' => ['group' => 'links', 'attribute' => 'show_underline_effect'],
|
||||||
|
'linksUnderlineColor' => ['group' => 'links', 'attribute' => 'underline_color'],
|
||||||
|
|
||||||
|
// Visual Effects (Dropdown)
|
||||||
|
'dropdownBgColor' => ['group' => 'visual_effects', 'attribute' => 'background_color'],
|
||||||
|
'dropdownBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
||||||
|
'dropdownShadow' => ['group' => 'visual_effects', 'attribute' => 'shadow'],
|
||||||
|
'dropdownItemColor' => ['group' => 'visual_effects', 'attribute' => 'item_color'],
|
||||||
|
'dropdownItemHoverBg' => ['group' => 'visual_effects', 'attribute' => 'item_hover_background'],
|
||||||
|
'dropdownItemPadding' => ['group' => 'visual_effects', 'attribute' => 'item_padding'],
|
||||||
|
'dropdownMaxHeight' => ['group' => 'visual_effects', 'attribute' => 'dropdown_max_height'],
|
||||||
|
|
||||||
|
// Colors (Navbar styles)
|
||||||
|
'navbarBgColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
||||||
|
'navbarBoxShadow' => ['group' => 'colors', 'attribute' => 'box_shadow'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\RelatedPost\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Related Post
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*
|
||||||
|
* NOTA: Este componente NO tenia mapeos en AdminAjaxHandler
|
||||||
|
* (era el unico componente roto - 35 campos no se guardaban)
|
||||||
|
*/
|
||||||
|
final class RelatedPostFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'related-post';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'relatedPostEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'relatedPostShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'relatedPostShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'relatedPostShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'relatedPostSectionTitle' => ['group' => 'content', 'attribute' => 'section_title'],
|
||||||
|
'relatedPostPerPage' => ['group' => 'content', 'attribute' => 'posts_per_page'],
|
||||||
|
'relatedPostOrderby' => ['group' => 'content', 'attribute' => 'orderby'],
|
||||||
|
'relatedPostOrder' => ['group' => 'content', 'attribute' => 'order'],
|
||||||
|
'relatedPostShowPagination' => ['group' => 'content', 'attribute' => 'show_pagination'],
|
||||||
|
|
||||||
|
// Layout
|
||||||
|
'relatedPostColsDesktop' => ['group' => 'layout', 'attribute' => 'columns_desktop'],
|
||||||
|
'relatedPostColsTablet' => ['group' => 'layout', 'attribute' => 'columns_tablet'],
|
||||||
|
'relatedPostColsMobile' => ['group' => 'layout', 'attribute' => 'columns_mobile'],
|
||||||
|
|
||||||
|
// Typography
|
||||||
|
'relatedPostSectionTitleSize' => ['group' => 'typography', 'attribute' => 'section_title_size'],
|
||||||
|
'relatedPostSectionTitleWeight' => ['group' => 'typography', 'attribute' => 'section_title_weight'],
|
||||||
|
'relatedPostCardTitleSize' => ['group' => 'typography', 'attribute' => 'card_title_size'],
|
||||||
|
'relatedPostCardTitleWeight' => ['group' => 'typography', 'attribute' => 'card_title_weight'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'relatedPostSectionTitleColor' => ['group' => 'colors', 'attribute' => 'section_title_color'],
|
||||||
|
'relatedPostCardBgColor' => ['group' => 'colors', 'attribute' => 'card_bg_color'],
|
||||||
|
'relatedPostCardTitleColor' => ['group' => 'colors', 'attribute' => 'card_title_color'],
|
||||||
|
'relatedPostCardHoverBgColor' => ['group' => 'colors', 'attribute' => 'card_hover_bg_color'],
|
||||||
|
'relatedPostPaginationBgColor' => ['group' => 'colors', 'attribute' => 'pagination_bg_color'],
|
||||||
|
'relatedPostPaginationTextColor' => ['group' => 'colors', 'attribute' => 'pagination_text_color'],
|
||||||
|
'relatedPostPaginationActiveBg' => ['group' => 'colors', 'attribute' => 'pagination_active_bg'],
|
||||||
|
'relatedPostPaginationActiveText' => ['group' => 'colors', 'attribute' => 'pagination_active_text'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'relatedPostSectionMarginTop' => ['group' => 'spacing', 'attribute' => 'section_margin_top'],
|
||||||
|
'relatedPostSectionMarginBottom' => ['group' => 'spacing', 'attribute' => 'section_margin_bottom'],
|
||||||
|
'relatedPostTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
||||||
|
'relatedPostGridGap' => ['group' => 'spacing', 'attribute' => 'grid_gap'],
|
||||||
|
'relatedPostCardPadding' => ['group' => 'spacing', 'attribute' => 'card_padding'],
|
||||||
|
'relatedPostPaginationMarginTop' => ['group' => 'spacing', 'attribute' => 'pagination_margin_top'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'relatedPostCardBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'card_border_radius'],
|
||||||
|
'relatedPostCardShadow' => ['group' => 'visual_effects', 'attribute' => 'card_shadow'],
|
||||||
|
'relatedPostCardHoverShadow' => ['group' => 'visual_effects', 'attribute' => 'card_hover_shadow'],
|
||||||
|
'relatedPostCardTransition' => ['group' => 'visual_effects', 'attribute' => 'card_transition'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
38
Admin/Shared/Domain/Contracts/FieldMapperInterface.php
Normal file
38
Admin/Shared/Domain/Contracts/FieldMapperInterface.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\Shared\Domain\Contracts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contrato para mapeo de campos de formulario a atributos de BD
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Definir el mapeo de field IDs a grupos/atributos
|
||||||
|
* - Cada modulo implementa su propio mapper
|
||||||
|
*
|
||||||
|
* PRINCIPIOS:
|
||||||
|
* - ISP: Interfaz pequena (2 metodos)
|
||||||
|
* - DIP: Capas superiores dependen de esta abstraccion
|
||||||
|
*/
|
||||||
|
interface FieldMapperInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Retorna el nombre del componente que mapea
|
||||||
|
*
|
||||||
|
* @return string Nombre en kebab-case (ej: 'cta-box-sidebar')
|
||||||
|
*/
|
||||||
|
public function getComponentName(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retorna el mapeo de field IDs a grupo/atributo
|
||||||
|
*
|
||||||
|
* @return array<string, array{group: string, attribute: string}>
|
||||||
|
*
|
||||||
|
* Ejemplo:
|
||||||
|
* [
|
||||||
|
* 'ctaTitle' => ['group' => 'content', 'attribute' => 'title'],
|
||||||
|
* 'ctaEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
* ]
|
||||||
|
*/
|
||||||
|
public function getFieldMapping(): array;
|
||||||
|
}
|
||||||
145
Admin/Shared/Infrastructure/Api/Wordpress/AdminAjaxHandler.php
Normal file
145
Admin/Shared/Infrastructure/Api/Wordpress/AdminAjaxHandler.php
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\Shared\Infrastructure\Api\Wordpress;
|
||||||
|
|
||||||
|
use ROITheme\Shared\Application\UseCases\SaveComponentSettings\SaveComponentSettingsUseCase;
|
||||||
|
use ROITheme\Admin\Shared\Infrastructure\FieldMapping\FieldMapperRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler para peticiones AJAX del panel de administracion
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Manejar HTTP (request/response)
|
||||||
|
* - Delegar mapeo a FieldMapperRegistry
|
||||||
|
* - NO contiene logica de mapeo
|
||||||
|
*
|
||||||
|
* PRINCIPIOS:
|
||||||
|
* - SRP: Solo maneja HTTP
|
||||||
|
* - OCP: Nuevos componentes no requieren modificar esta clase
|
||||||
|
* - DIP: Depende de abstracciones (FieldMapperRegistry)
|
||||||
|
*/
|
||||||
|
final class AdminAjaxHandler
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly ?SaveComponentSettingsUseCase $saveComponentSettingsUseCase = null,
|
||||||
|
private readonly ?FieldMapperRegistry $fieldMapperRegistry = null
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
add_action('wp_ajax_roi_save_component_settings', [$this, 'saveComponentSettings']);
|
||||||
|
add_action('wp_ajax_roi_reset_component_defaults', [$this, 'resetComponentDefaults']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveComponentSettings(): void
|
||||||
|
{
|
||||||
|
check_ajax_referer('roi_admin_dashboard', 'nonce');
|
||||||
|
|
||||||
|
if (!current_user_can('manage_options')) {
|
||||||
|
wp_send_json_error(['message' => 'No tienes permisos para realizar esta accion.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$component = sanitize_text_field($_POST['component'] ?? '');
|
||||||
|
$settings = json_decode(stripslashes($_POST['settings'] ?? '{}'), true);
|
||||||
|
|
||||||
|
if (empty($component) || empty($settings)) {
|
||||||
|
wp_send_json_error(['message' => 'Datos incompletos.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtener mapper del modulo correspondiente
|
||||||
|
if ($this->fieldMapperRegistry === null || !$this->fieldMapperRegistry->hasMapper($component)) {
|
||||||
|
wp_send_json_error([
|
||||||
|
'message' => "No existe mapper para el componente: {$component}"
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$mapper = $this->fieldMapperRegistry->getMapper($component);
|
||||||
|
$fieldMapping = $mapper->getFieldMapping();
|
||||||
|
|
||||||
|
// Mapear settings usando el mapper del modulo
|
||||||
|
$mappedSettings = $this->mapSettings($settings, $fieldMapping);
|
||||||
|
|
||||||
|
// Guardar usando Use Case
|
||||||
|
if ($this->saveComponentSettingsUseCase !== null) {
|
||||||
|
$updated = $this->saveComponentSettingsUseCase->execute($component, $mappedSettings);
|
||||||
|
wp_send_json_success([
|
||||||
|
'message' => sprintf('Se guardaron %d campos correctamente.', $updated)
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
wp_send_json_error(['message' => 'Error: Use Case no disponible.']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapea settings de field IDs a grupos/atributos
|
||||||
|
*/
|
||||||
|
private function mapSettings(array $settings, array $fieldMapping): array
|
||||||
|
{
|
||||||
|
$mappedSettings = [];
|
||||||
|
|
||||||
|
foreach ($settings as $fieldId => $value) {
|
||||||
|
if (!isset($fieldMapping[$fieldId])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mapping = $fieldMapping[$fieldId];
|
||||||
|
$groupName = $mapping['group'];
|
||||||
|
$attributeName = $mapping['attribute'];
|
||||||
|
|
||||||
|
if (!isset($mappedSettings[$groupName])) {
|
||||||
|
$mappedSettings[$groupName] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$mappedSettings[$groupName][$attributeName] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $mappedSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetComponentDefaults(): void
|
||||||
|
{
|
||||||
|
// Verificar nonce
|
||||||
|
check_ajax_referer('roi_admin_dashboard', 'nonce');
|
||||||
|
|
||||||
|
// Verificar permisos
|
||||||
|
if (!current_user_can('manage_options')) {
|
||||||
|
wp_send_json_error([
|
||||||
|
'message' => 'No tienes permisos para realizar esta accion.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtener componente
|
||||||
|
$component = sanitize_text_field($_POST['component'] ?? '');
|
||||||
|
|
||||||
|
if (empty($component)) {
|
||||||
|
wp_send_json_error([
|
||||||
|
'message' => 'Componente no especificado.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ruta al schema JSON
|
||||||
|
$schemaPath = get_template_directory() . '/Schemas/' . $component . '.json';
|
||||||
|
|
||||||
|
if (!file_exists($schemaPath)) {
|
||||||
|
wp_send_json_error([
|
||||||
|
'message' => 'Schema del componente no encontrado.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usar repositorio para restaurar valores
|
||||||
|
if ($this->saveComponentSettingsUseCase !== null) {
|
||||||
|
global $wpdb;
|
||||||
|
$repository = new \ROITheme\Shared\Infrastructure\Persistence\Wordpress\WordPressComponentSettingsRepository($wpdb);
|
||||||
|
$updated = $repository->resetToDefaults($component, $schemaPath);
|
||||||
|
|
||||||
|
wp_send_json_success([
|
||||||
|
'message' => sprintf('Se restauraron %d campos a sus valores por defecto.', $updated)
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
wp_send_json_error([
|
||||||
|
'message' => 'Error: Repositorio no disponible.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\Shared\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provider para auto-registro de Field Mappers
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Descubrir automaticamente FieldMappers en cada modulo
|
||||||
|
* - Registrarlos en el FieldMapperRegistry
|
||||||
|
*
|
||||||
|
* BENEFICIO:
|
||||||
|
* - Agregar nuevo componente = crear FieldMapper (sin tocar functions.php)
|
||||||
|
* - Eliminar componente = borrar carpeta (limpieza automatica)
|
||||||
|
*/
|
||||||
|
final class FieldMapperProvider
|
||||||
|
{
|
||||||
|
private const MODULES = [
|
||||||
|
'TopNotificationBar',
|
||||||
|
'Navbar',
|
||||||
|
'CtaLetsTalk',
|
||||||
|
'Hero',
|
||||||
|
'FeaturedImage',
|
||||||
|
'TableOfContents',
|
||||||
|
'CtaBoxSidebar',
|
||||||
|
'SocialShare',
|
||||||
|
'CtaPost',
|
||||||
|
'RelatedPost',
|
||||||
|
'ContactForm',
|
||||||
|
'Footer',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private readonly FieldMapperRegistry $registry
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registra todos los FieldMappers disponibles
|
||||||
|
*/
|
||||||
|
public function registerAll(): void
|
||||||
|
{
|
||||||
|
foreach (self::MODULES as $module) {
|
||||||
|
$this->registerIfExists($module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registra un mapper si existe la clase
|
||||||
|
*/
|
||||||
|
private function registerIfExists(string $module): void
|
||||||
|
{
|
||||||
|
$className = sprintf(
|
||||||
|
'ROITheme\\Admin\\%s\\Infrastructure\\FieldMapping\\%sFieldMapper',
|
||||||
|
$module,
|
||||||
|
$module
|
||||||
|
);
|
||||||
|
|
||||||
|
if (class_exists($className)) {
|
||||||
|
$mapper = new $className();
|
||||||
|
if ($mapper instanceof FieldMapperInterface) {
|
||||||
|
$this->registry->register($mapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\Shared\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registro central de Field Mappers
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Registrar mappers de cada modulo
|
||||||
|
* - Resolver mapper por nombre de componente
|
||||||
|
*
|
||||||
|
* PRINCIPIOS:
|
||||||
|
* - OCP: Nuevos mappers se registran sin modificar esta clase
|
||||||
|
* - SRP: Solo gestiona el registro, no contiene mapeos
|
||||||
|
*/
|
||||||
|
final class FieldMapperRegistry
|
||||||
|
{
|
||||||
|
/** @var array<string, FieldMapperInterface> */
|
||||||
|
private array $mappers = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registra un mapper
|
||||||
|
*/
|
||||||
|
public function register(FieldMapperInterface $mapper): void
|
||||||
|
{
|
||||||
|
$this->mappers[$mapper->getComponentName()] = $mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtiene un mapper por nombre de componente
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException Si no existe mapper para el componente
|
||||||
|
*/
|
||||||
|
public function getMapper(string $componentName): FieldMapperInterface
|
||||||
|
{
|
||||||
|
if (!isset($this->mappers[$componentName])) {
|
||||||
|
throw new \InvalidArgumentException(
|
||||||
|
"No field mapper registered for component: {$componentName}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->mappers[$componentName];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifica si existe mapper para un componente
|
||||||
|
*/
|
||||||
|
public function hasMapper(string $componentName): bool
|
||||||
|
{
|
||||||
|
return isset($this->mappers[$componentName]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtiene todos los mappers registrados
|
||||||
|
*
|
||||||
|
* @return array<string, FieldMapperInterface>
|
||||||
|
*/
|
||||||
|
public function getAllMappers(): array
|
||||||
|
{
|
||||||
|
return $this->mappers;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\SocialShare\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Social Share
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class SocialShareFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'social-share';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'socialShareEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'socialShareShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'socialShareShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'socialShareShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'socialShareShowLabel' => ['group' => 'content', 'attribute' => 'show_label'],
|
||||||
|
'socialShareLabelText' => ['group' => 'content', 'attribute' => 'label_text'],
|
||||||
|
|
||||||
|
// Networks
|
||||||
|
'socialShareFacebook' => ['group' => 'networks', 'attribute' => 'show_facebook'],
|
||||||
|
'socialShareFacebookUrl' => ['group' => 'networks', 'attribute' => 'facebook_url'],
|
||||||
|
'socialShareInstagram' => ['group' => 'networks', 'attribute' => 'show_instagram'],
|
||||||
|
'socialShareInstagramUrl' => ['group' => 'networks', 'attribute' => 'instagram_url'],
|
||||||
|
'socialShareLinkedin' => ['group' => 'networks', 'attribute' => 'show_linkedin'],
|
||||||
|
'socialShareLinkedinUrl' => ['group' => 'networks', 'attribute' => 'linkedin_url'],
|
||||||
|
'socialShareWhatsapp' => ['group' => 'networks', 'attribute' => 'show_whatsapp'],
|
||||||
|
'socialShareWhatsappNumber' => ['group' => 'networks', 'attribute' => 'whatsapp_number'],
|
||||||
|
'socialShareTwitter' => ['group' => 'networks', 'attribute' => 'show_twitter'],
|
||||||
|
'socialShareTwitterUrl' => ['group' => 'networks', 'attribute' => 'twitter_url'],
|
||||||
|
'socialShareEmail' => ['group' => 'networks', 'attribute' => 'show_email'],
|
||||||
|
'socialShareEmailAddress' => ['group' => 'networks', 'attribute' => 'email_address'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'socialShareLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'],
|
||||||
|
'socialShareBorderTopColor' => ['group' => 'colors', 'attribute' => 'border_top_color'],
|
||||||
|
'socialShareButtonBg' => ['group' => 'colors', 'attribute' => 'button_background'],
|
||||||
|
'socialShareFacebookColor' => ['group' => 'colors', 'attribute' => 'facebook_color'],
|
||||||
|
'socialShareInstagramColor' => ['group' => 'colors', 'attribute' => 'instagram_color'],
|
||||||
|
'socialShareLinkedinColor' => ['group' => 'colors', 'attribute' => 'linkedin_color'],
|
||||||
|
'socialShareWhatsappColor' => ['group' => 'colors', 'attribute' => 'whatsapp_color'],
|
||||||
|
'socialShareTwitterColor' => ['group' => 'colors', 'attribute' => 'twitter_color'],
|
||||||
|
'socialShareEmailColor' => ['group' => 'colors', 'attribute' => 'email_color'],
|
||||||
|
|
||||||
|
// Typography
|
||||||
|
'socialShareLabelFontSize' => ['group' => 'typography', 'attribute' => 'label_font_size'],
|
||||||
|
'socialShareIconFontSize' => ['group' => 'typography', 'attribute' => 'icon_font_size'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'socialShareMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'],
|
||||||
|
'socialShareMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'],
|
||||||
|
'socialSharePaddingTop' => ['group' => 'spacing', 'attribute' => 'container_padding_top'],
|
||||||
|
'socialSharePaddingBottom' => ['group' => 'spacing', 'attribute' => 'container_padding_bottom'],
|
||||||
|
'socialShareLabelMarginBottom' => ['group' => 'spacing', 'attribute' => 'label_margin_bottom'],
|
||||||
|
'socialShareButtonsGap' => ['group' => 'spacing', 'attribute' => 'buttons_gap'],
|
||||||
|
'socialShareButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'socialShareBorderTopWidth' => ['group' => 'visual_effects', 'attribute' => 'border_top_width'],
|
||||||
|
'socialShareButtonBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'button_border_width'],
|
||||||
|
'socialShareButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
|
||||||
|
'socialShareTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
||||||
|
'socialShareHoverBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'hover_box_shadow'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\TableOfContents\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Table of Contents
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class TableOfContentsFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'table-of-contents';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'tocEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'tocShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'tocShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'tocShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'tocTitle' => ['group' => 'content', 'attribute' => 'title'],
|
||||||
|
'tocAutoGenerate' => ['group' => 'content', 'attribute' => 'auto_generate'],
|
||||||
|
'tocHeadingLevels' => ['group' => 'content', 'attribute' => 'heading_levels'],
|
||||||
|
'tocSmoothScroll' => ['group' => 'content', 'attribute' => 'smooth_scroll'],
|
||||||
|
|
||||||
|
// Typography
|
||||||
|
'tocTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
|
||||||
|
'tocTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
|
||||||
|
'tocLinkFontSize' => ['group' => 'typography', 'attribute' => 'link_font_size'],
|
||||||
|
'tocLinkLineHeight' => ['group' => 'typography', 'attribute' => 'link_line_height'],
|
||||||
|
'tocLevelThreeFontSize' => ['group' => 'typography', 'attribute' => 'level_three_font_size'],
|
||||||
|
'tocLevelFourFontSize' => ['group' => 'typography', 'attribute' => 'level_four_font_size'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'tocBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
||||||
|
'tocBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'],
|
||||||
|
'tocTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
|
||||||
|
'tocTitleBorderColor' => ['group' => 'colors', 'attribute' => 'title_border_color'],
|
||||||
|
'tocLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'],
|
||||||
|
'tocLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'],
|
||||||
|
'tocLinkHoverBackground' => ['group' => 'colors', 'attribute' => 'link_hover_background'],
|
||||||
|
'tocActiveBorderColor' => ['group' => 'colors', 'attribute' => 'active_border_color'],
|
||||||
|
'tocActiveBackgroundColor' => ['group' => 'colors', 'attribute' => 'active_background_color'],
|
||||||
|
'tocActiveTextColor' => ['group' => 'colors', 'attribute' => 'active_text_color'],
|
||||||
|
'tocScrollbarTrackColor' => ['group' => 'colors', 'attribute' => 'scrollbar_track_color'],
|
||||||
|
'tocScrollbarThumbColor' => ['group' => 'colors', 'attribute' => 'scrollbar_thumb_color'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'tocContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'],
|
||||||
|
'tocMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'],
|
||||||
|
'tocTitlePaddingBottom' => ['group' => 'spacing', 'attribute' => 'title_padding_bottom'],
|
||||||
|
'tocTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
|
||||||
|
'tocItemMarginBottom' => ['group' => 'spacing', 'attribute' => 'item_margin_bottom'],
|
||||||
|
'tocLinkPadding' => ['group' => 'spacing', 'attribute' => 'link_padding'],
|
||||||
|
'tocLevelThreePaddingLeft' => ['group' => 'spacing', 'attribute' => 'level_three_padding_left'],
|
||||||
|
'tocLevelFourPaddingLeft' => ['group' => 'spacing', 'attribute' => 'level_four_padding_left'],
|
||||||
|
'tocScrollbarWidth' => ['group' => 'spacing', 'attribute' => 'scrollbar_width'],
|
||||||
|
|
||||||
|
// Visual Effects
|
||||||
|
'tocBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
|
||||||
|
'tocBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
|
||||||
|
'tocBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'],
|
||||||
|
'tocLinkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'link_border_radius'],
|
||||||
|
'tocActiveBorderLeftWidth' => ['group' => 'visual_effects', 'attribute' => 'active_border_left_width'],
|
||||||
|
'tocTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
|
||||||
|
'tocScrollbarBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'scrollbar_border_radius'],
|
||||||
|
|
||||||
|
// Behavior
|
||||||
|
'tocIsSticky' => ['group' => 'behavior', 'attribute' => 'is_sticky'],
|
||||||
|
'tocScrollOffset' => ['group' => 'behavior', 'attribute' => 'scroll_offset'],
|
||||||
|
'tocMaxHeight' => ['group' => 'behavior', 'attribute' => 'max_height'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ROITheme\Admin\TopNotificationBar\Infrastructure\FieldMapping;
|
||||||
|
|
||||||
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field Mapper para Top Notification Bar
|
||||||
|
*
|
||||||
|
* RESPONSABILIDAD:
|
||||||
|
* - Mapear field IDs del formulario a atributos de BD
|
||||||
|
* - Solo conoce sus propios campos (modularidad)
|
||||||
|
*/
|
||||||
|
final class TopNotificationBarFieldMapper implements FieldMapperInterface
|
||||||
|
{
|
||||||
|
public function getComponentName(): string
|
||||||
|
{
|
||||||
|
return 'top-notification-bar';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldMapping(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Visibility
|
||||||
|
'topBarEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||||
|
'topBarShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
|
||||||
|
'topBarShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
|
||||||
|
'topBarShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'],
|
||||||
|
|
||||||
|
// Content
|
||||||
|
'topBarIconClass' => ['group' => 'content', 'attribute' => 'icon_class'],
|
||||||
|
'topBarLabelText' => ['group' => 'content', 'attribute' => 'label_text'],
|
||||||
|
'topBarMessageText' => ['group' => 'content', 'attribute' => 'message_text'],
|
||||||
|
'topBarLinkText' => ['group' => 'content', 'attribute' => 'link_text'],
|
||||||
|
'topBarLinkUrl' => ['group' => 'content', 'attribute' => 'link_url'],
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
'topBarBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'],
|
||||||
|
'topBarTextColor' => ['group' => 'colors', 'attribute' => 'text_color'],
|
||||||
|
'topBarLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'],
|
||||||
|
'topBarIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'],
|
||||||
|
'topBarLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'],
|
||||||
|
'topBarLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'],
|
||||||
|
|
||||||
|
// Spacing
|
||||||
|
'topBarFontSize' => ['group' => 'spacing', 'attribute' => 'font_size'],
|
||||||
|
'topBarPadding' => ['group' => 'spacing', 'attribute' => 'padding'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -126,8 +126,16 @@ try {
|
|||||||
// Obtener Use Case para guardar configuraciones
|
// Obtener Use Case para guardar configuraciones
|
||||||
$saveComponentSettingsUseCase = $container?->getSaveComponentSettingsUseCase();
|
$saveComponentSettingsUseCase = $container?->getSaveComponentSettingsUseCase();
|
||||||
|
|
||||||
// Crear y registrar el handler AJAX con inyección del Use Case
|
// === FIELD MAPPER REGISTRY (Auto-registro escalable) ===
|
||||||
$adminAjaxHandler = new \ROITheme\Admin\Infrastructure\Api\Wordpress\AdminAjaxHandler($saveComponentSettingsUseCase);
|
$fieldMapperRegistry = new \ROITheme\Admin\Shared\Infrastructure\FieldMapping\FieldMapperRegistry();
|
||||||
|
$fieldMapperProvider = new \ROITheme\Admin\Shared\Infrastructure\FieldMapping\FieldMapperProvider($fieldMapperRegistry);
|
||||||
|
$fieldMapperProvider->registerAll();
|
||||||
|
|
||||||
|
// === ADMIN AJAX HANDLER ===
|
||||||
|
$adminAjaxHandler = new \ROITheme\Admin\Shared\Infrastructure\Api\Wordpress\AdminAjaxHandler(
|
||||||
|
$saveComponentSettingsUseCase,
|
||||||
|
$fieldMapperRegistry
|
||||||
|
);
|
||||||
$adminAjaxHandler->register();
|
$adminAjaxHandler->register();
|
||||||
|
|
||||||
// Crear y registrar el handler AJAX para el Contact Form (público)
|
// Crear y registrar el handler AJAX para el Contact Form (público)
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
"phone_label": {
|
"phone_label": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Label telefono",
|
"label": "Label telefono",
|
||||||
"default": "Teléfono",
|
"default": "WhatsApp",
|
||||||
"editable": true
|
"editable": true
|
||||||
},
|
},
|
||||||
"phone_value": {
|
"phone_value": {
|
||||||
@@ -262,7 +262,7 @@
|
|||||||
"info_value_color": {
|
"info_value_color": {
|
||||||
"type": "color",
|
"type": "color",
|
||||||
"label": "Color valores info",
|
"label": "Color valores info",
|
||||||
"default": "#6c757d",
|
"default": "#AAAAAA",
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"description": "text-muted"
|
"description": "text-muted"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user