'Domyślny'))); } function st_theme_layout_field($name, stThemeConfig $config, ThemeConfig $theme_config) { $layout_config = $config->get('layout_config'); $parameter = $layout_config[$name]; if ($parameter) { $default = isset($parameter['default']) ? $parameter['default'] : null; $type = isset($parameter['type']) ? $parameter['type'] : 'layout'; switch ($type) { case 'layout': $choices = array(); foreach ($parameter['layouts'] as $layout) { $choices[$layout] = __($layout_config['_layouts'][$layout]); } $layouts = $theme_config->getConfigParameter('layouts'); $value = isset($layouts['config'][$name]) ? $layouts['config'][$name] : $default; echo st_admin_get_form_field('layout_config[layout]['.$name.']', __($parameter['label']), $value, 'select_tag', array('choices' => $choices)); break; case 'choice': case 'choice_range': $choices = array(); if ($parameter['type'] == 'choice_range') { $choices = range($parameter['start'], $parameter['end'], isset($parameter['step']) ? $parameter['step'] : 1); $choices = array_combine($choices, $choices); } elseif (isset($parameter['choices'])) { foreach ($parameter['choices'] as $value => $label) { $choices[$value] = __($label); } } $value = $theme_config->getConfigParameter('layout_config.'.$name, $default); echo st_admin_get_form_field('layout_config[custom]['.$name.']', __($parameter['label']), $value, 'select_tag', array('choices' => $choices)); break; } } } function st_theme_generate_editor_fields($category, stThemeEditorConfig $editor_config, ThemeConfig $theme_config) { if (is_array($category)) { foreach ($editor_config->getGraphicFields($category) as $field) { $name = $category[0]; $help = __($editor_config->getGraphicFieldParameter($name, $field, 'help')); $label = $editor_config->getGraphicFieldParameter($name, $field, 'label'); $default = $editor_config->getGraphicFieldParameter($name, $field, 'default'); if ($editor_config->isGraphicFieldRelated($name, $field)) { $value = $theme_config->getLess($field); echo st_admin_get_form_field('theme_config['.$name.']['.$field.']', __($label), $value == 'transparent' ? '' : $value, 'st_theme_colorpicker_input_tag', array('default' => $default, 'help' => $help)); } else { $value = $theme_config->getLess($field, $default); echo st_admin_get_form_field('theme_config['.$name.']['.$field.']', __($label), $value == 'transparent' ? '' : $value, 'st_colorpicker_input_tag', array('help' => $help)); } } } else { foreach ($editor_config->getGraphicFields($category) as $field) { $help = __($editor_config->getGraphicFieldParameter($category, $field, 'help')); $label = $editor_config->getGraphicFieldParameter($category, $field, 'label'); $default = $editor_config->getGraphicFieldParameter($category, $field, 'default'); if ($editor_config->hasGraphicFieldType($category, $field, 'css')) { if ($editor_config->hasGraphicFieldProperty($category, $field, 'background-image')) { echo st_admin_get_form_field('theme_config['.$category.']['.$field.']', __($label), $theme_config->getCss($category, $field, $default), 'st_theme_upload_image_tag', array('theme_config' => $theme_config, 'help' => $help)); } elseif ($editor_config->hasGraphicFieldProperty($category, $field, 'background-repeat')) { echo st_admin_get_form_field('theme_config['.$category.']['.$field.']', __($label), $theme_config->getCss($category, $field, $default), 'st_theme_background_repeat_tag', array('help' => $help)); } elseif ($editor_config->isGraphicFieldRelated($category, $field)) { $value = $theme_config->getCss($category, $field); echo st_admin_get_form_field('theme_config['.$category.']['.$field.']', __($label), $value == 'transparent' ? '' : $value, 'st_theme_colorpicker_input_tag', array('default' => $default, 'help' => $help)); } else { $value = $theme_config->getCss($category, $field, $default); echo st_admin_get_form_field('theme_config['.$category.']['.$field.']', __($label), $value == 'transparent' ? '' : $value, 'st_colorpicker_input_tag', array('help' => $help)); } } elseif ($editor_config->hasGraphicFieldType($category, $field, 'image')) { echo st_admin_get_form_field('theme_config['.$category.']['.$field.']', __($label), $theme_config->getImage($category, $field, $default), 'st_theme_upload_image_tag', array('theme_config' => $theme_config, 'help' => $help)); } } } } function st_theme_colorpicker_input_tag($name, $value, $params = array()) { $default = $params['default']; $colorpicker_tag = st_colorpicker_input_tag($name, $value ? $value : $default, array('disabled' => null === $value)); $default_tag = label_for($name.'[default]', __('kolor z palety'), array('style' => 'float: none')).checkbox_tag($name.'[default]', true, null === $value); $id = get_id_from_name($name); $html = <<$colorpicker_tag
'.st_admin_checkbox_tag($name.'[restore]', true, false, array('label' => __('przywróć domyślne'))).'
'; } $preview_tag = "