$typeParams[$sT] = $sTParams['params']; } } $possibleTypes = implode('||', $possibleTypes); } $allTypes = array(); foreach (explode('||', $possibleTypes) as $t) { list($k, $v) = explode('|', $t); $allTypes[$k] = $v; } $type = isset($cloneSection['@attributes']['type']) ? $cloneSection['@attributes']['type'] : 'Default'; $typeValue = isset($allTypes[$type]) ? $allTypes[$type] : 'Default'; $defaultType = strtolower($type); $returnUpdate = ''; $returnUpdate .= '<div class="csHandle"><span class="handle"></span></div>'; $returnUpdate .= '<div class="csTitle"><span class="' . $xEditSelectorSimple . ' xProperty-title xNoHTMLEntities xSection-' . $sName . '">' . ($isClone ? htmlspecialchars($sTitle) : BertaEditor::getXEmpty('sectionTitle')) . '</span></div>'; $returnUpdate .= '<div class="csBehaviour"><span class="' . $xEditSelectorSelectRC . ' xProperty-type xSection-' . $sName . ' xSectionField" x_options="' . $possibleTypes . '">' . htmlspecialchars($typeValue) . '</span></div>'; $returnUpdate .= '<div class="csDetails">'; if (!empty($typeParams[$defaultType])) { //remove responsive section settings if ($berta->template->settings->get('pageLayout', 'responsive') != 'yes') { unset($typeParams['default']['columns'], $typeParams['default']['entryMaxWidth'], $typeParams['default']['entryPadding'], $typeParams['shop']['columns'], $typeParams['shop']['entryMaxWidth'], $typeParams['shop']['entryPadding']); } foreach ($typeParams[$defaultType] as $pName => $p) { $value = isset($cloneSection[$pName]['value']) && !empty($cloneSection[$pName]['value']) ? $cloneSection[$pName]['value'] : ''; if (!$value && $p['default']) { $value = $p['default']; } $returnUpdate .= BertaEditor::getSettingsItemEditHTML($pName, $p, $value, array('xSection' => $sName, 'xSectionField')); } }
$possibleTypes = 'default|Default'; $typeParams = array(); if (!empty($berta->template->sectionTypes)) { $possibleTypes = array(); foreach ($berta->template->sectionTypes as $sT => $sTParams) { $possibleTypes[] = "{$sT}|{$sTParams['title']}"; if (!empty($sTParams['params'])) { $typeParams[$sT] = $sTParams['params']; } } $possibleTypes = implode('||', $possibleTypes); } $type = 'Default'; $returnUpdate = ''; $returnUpdate .= '<div class="csHandle"><span class="handle"></span></div>'; $returnUpdate .= '<div class="csTitle"><span class="' . $xEditSelectorSimple . ' xProperty-title xNoHTMLEntities xSection-' . $sName . '">' . BertaEditor::getXEmpty('sectionTitle') . '</span></div>'; //$returnUpdate .= '<div class="csBehaviour"><span class="' . $xEditSelectorSelect . ' xProperty-sectionsEditor/behaviour xParam-' . $sName . '" x_options="normal||external link">normal</span></div>'; $returnUpdate .= '<div class="csBehaviour"><span class="' . $xEditSelectorSelectRC . ' xProperty-type xSection-' . $sName . ' xSectionField" x_options="' . $possibleTypes . '">' . htmlspecialchars($type) . '</span></div>'; //$returnUpdate .= '<div class="csBehaviour"><a href="#">reload page</a></div>'; $returnUpdate .= '<div class="csDetails"></div>'; //$returnUpdate .= '<div class="csLink"><span class="' . $xEditSelectorSimple . ' xProperty-sectionLink xParam-' . $sName . '" title="Link of the website where to lead the visitor when s/he navigates to this section">' . BertaEditor::getXEmpty('sectionLink') . '</span></div>'; $returnUpdate .= '<div class="csPub"><span class="' . $xEditSelectorYesNo . ' xProperty-published xSection-' . $sName . '">1</span></div>'; $returnUpdate .= '<div class="csDelete"><a href="#" class="xSectionDelete">delete</a></div>'; $returnReal = $sName; $sectionsList = BertaEditor::getSections(); $sectionsList[$sName] = array('@attributes' => array('tags_behavior' => 'invisible', 'published' => 1), 'name' => $sName, 'title' => array('value' => '')); BertaEditor::saveSections($sectionsList); } } } else { if ($decoded['action'] == 'DELETE_SECTION') {