buildHeader($componentId); $html .= '
'; // Columna unica - Custom Code $html .= '
'; $html .= $this->buildCustomCodeGroup($componentId); $html .= '
'; $html .= '
'; return $html; } private function buildHeader(string $componentId): string { $html = '
renderer->getFieldValue($componentId, 'custom_code', 'custom_css', ''); $html .= $this->buildTextareaCode('themeSettingsCustomCss', 'CSS Personalizado', 'bi-filetype-css', $customCss, 'Se inyecta en wp_head. No incluir etiquetas <style>'); $customJsHeader = $this->renderer->getFieldValue($componentId, 'custom_code', 'custom_js_header', ''); $html .= $this->buildTextareaCode('themeSettingsCustomJsHeader', 'JavaScript en Header', 'bi-filetype-js', $customJsHeader, 'Se inyecta en wp_head. No incluir etiquetas <script>'); $customJsFooter = $this->renderer->getFieldValue($componentId, 'custom_code', 'custom_js_footer', ''); $html .= $this->buildTextareaCode('themeSettingsCustomJsFooter', 'JavaScript en Footer', 'bi-filetype-js', $customJsFooter, 'Se inyecta en wp_footer. No incluir etiquetas <script>'); $html .= '
'; $html .= ' '; $html .= ' Advertencia: El codigo personalizado puede afectar el rendimiento y seguridad del sitio.'; $html .= '
'; $html .= '
'; $html .= ''; return $html; } private function buildTextareaCode(string $id, string $label, string $icon, mixed $value, string $helpText = ''): string { $value = $this->normalizeStringValue($value); $html = '
'; $html .= ' '; $html .= ' '; if (!empty($helpText)) { $html .= '
' . $helpText . '
'; } $html .= '
'; return $html; } /** * Normaliza un valor a string para inputs de formulario */ private function normalizeStringValue(mixed $value): string { if ($value === false) { return '0'; } if ($value === true) { return '1'; } return (string) $value; } }