/** * Radio * @param type $element * @return string */ public static function render($element) { $element['class'] = isset($element['class']) ? $element['class'] : 'radio inline'; $element['type_input'] = 'radio'; return JSNTplMMHelperShortcode::renderParameter('checkbox', $element); }
/** * get HTML of Modal Settings Box of Shortcode * @param array $options * @return string */ public static function getShortcodeModalSettings($settings, $shortcode = '', $input_params = null, $raw_shortcode = null) { $i = 0; $tabs = $contents = $actions = $general_actions = array(); if ($shortcode != '') { $shortcodeName = strtolower(JSNTplMMHelperShortcode::shortcodeName($shortcode)); if ($shortcodeName != '') { JSNTplMMLoader::register(JSN_PATH_TPLFRAMEWORK_MEGAMENU_LIBRARIES . '/shortcodes/elements/' . $shortcodeName . '/html', 'JSNTplHelperHtml'); } } foreach ($settings as $tab => $options) { $options = self::ignoreSettings($options); if ($tab == 'action') { foreach ($options as $option) { $actions[] = JSNTplMMHelperShortcode::renderParameter($option['type'], $option); } } else { if ($tab == 'generalaction') { foreach ($options as $option) { $option['id'] = isset($option['id']) ? 'param-' . $option['id'] : ''; $general_actions[] = JSNTplMMHelperShortcode::renderParameter($option['type'], $option); } } else { $active = $i++ == 0 ? 'active' : ''; if (strtolower($tab) != 'notab') { $data_ = isset($settings[$tab]['settings']) ? $settings[$tab]['settings'] : array(); $data_['href'] = "#{$tab}"; $data_['data-toggle'] = 'tab'; $content_ = ucfirst($tab); $tabs[] = "<li class='{$active}'>" . self::tabSettings('a', $data_, $content_) . '</li>'; } $has_margin = 0; $param_html = array(); foreach ($options as $idx => $option) { // check if this element has Margin param (1) if (isset($option['name']) && $option['name'] == 'Margin' && $option['id'] != 'div_margin') { $has_margin = 1; } // if (1), don't use the 'auto extended margin ( top, bottom ) option' if ($has_margin && isset($option['id']) && $option['id'] == 'div_margin') { continue; } $type = $option['type']; $option['id'] = isset($option['id']) ? 'param-' . $option['id'] : "{$idx}"; if (!is_array($type)) { $param_html[$option['id']] = JSNTplMMHelperShortcode::renderParameter($type, $option, $input_params); } else { $output_inner = ''; foreach ($type as $sub_options) { $sub_options['id'] = isset($sub_options['id']) ? 'param-' . $sub_options['id'] : ''; /* for sub option, auto assign bound = 0 {not wrapped by <div class='controls'></div> } */ $sub_options['bound'] = '0'; /* for sub option, auto assign 'input-small' class */ $sub_options['class'] = isset($sub_options['class']) ? $sub_options['class'] : ''; $type = $sub_options['type']; $output_inner .= JSNTplMMHelperShortcode::renderParameter($type, $sub_options); } $option = JSNTplMMHelperHtml::getExtraInfo($option); $label = JSNTplMMHelperHtml::getLabel($option); $param_html[$option['id']] = JSNTplMMHelperHtml::finalElement($option, $output_inner, $label); } } if (!empty($param_html['param-copy_style_from'])) { array_pop($param_html); // move "auto extended margin ( top, bottom ) option" to top of output $style_copy = array_shift($param_html); // Shift Preview frame from the array $preview = array_shift($param_html); if (!empty($param_html['param-div_margin'])) { $margin = $param_html['param-div_margin']; $param_html = array_merge(array($preview, $style_copy, $margin), $param_html); } else { $param_html = array_merge(array($preview, $style_copy), $param_html); } } $param_html = implode('', $param_html); $content_tab = "<div class='tab-pane {$active} jsn-mm-setting-tab' id='{$tab}'>{$param_html}</div>"; $contents[] = $content_tab; } } } return self::settingTabHtml($shortcode, $tabs, $contents, $general_actions, $settings, $actions); }