2 namespace TYPO3\CMS\WizardCrpages\Controller;
62 $this->
getLanguageService()->includeLLFile(
'EXT:wizard_crpages/Resources/Private/Language/locallang.xlf');
65 $this->pagesTsConfig = isset($this->tsConfig[
'TCEFORM.'][
'pages.']) ? $this->tsConfig[
'TCEFORM.'][
'pages.'] : array();
68 $pageRecord =
BackendUtility::getRecord(
'pages', $this->pObj->id,
'uid',
' AND ' . $this->getBackendUser()->getPagePermsClause(8));
70 $menuItems = $pageRepository->getMenu($this->pObj->id,
'*',
'sorting',
'',
false);
71 if (is_array($pageRecord)) {
73 if (is_array($data[
'pages'])) {
75 $endI = end($menuItems);
76 $thePid = -(int)$endI[
'uid'];
78 $thePid = $this->pObj->id;
81 $thePid = $this->pObj->id;
84 $previousIdentifier =
'';
85 foreach ($data[
'pages'] as $identifier => $dat) {
86 if (!trim($dat[
'title'])) {
87 unset($data[
'pages'][$identifier]);
93 $data[
'pages'][$identifier][
'pid'] = $thePid;
95 $data[
'pages'][$identifier][
'pid'] =
'-' . $previousIdentifier;
97 $previousIdentifier = $identifier;
100 if (!empty($data[
'pages'])) {
103 $dataHandler->stripslashes_values = 0;
105 $TCAdefaultOverride = $this->
getBackendUser()->getTSConfigProp(
'TCAdefaults');
106 if (is_array($TCAdefaultOverride)) {
107 $dataHandler->setDefaultsFromUserTS($TCAdefaultOverride);
109 $dataHandler->start($data, array());
110 $dataHandler->process_datamap();
116 $theCode .= $flashMessage->render();
118 $menuItems = $pageRepository->getMenu($this->pObj->id,
'*',
'sorting',
'',
false);
120 foreach ($menuItems as $record) {
122 if (is_array($record)) {
126 $theCode .=
'<h4>' . $this->
getLanguageService()->getLL(
'wiz_newPages_currentMenu') .
'</h4>' . implode(
'<br />', $lines);
130 $tableData = array();
131 for ($a = 0; $a < 5; $a++) {
136 <div class="form-group t3js-wizardcrpages-container">
137 ' . implode(LF, $tableData) .
'
139 <div class="form-group">
140 <input class="btn btn-default t3js-wizardcrpages-createnewfields" type="button" value="' . $this->
getLanguageService()->getLL(
'wiz_newPages_addMoreLines') .
'" />
142 <div class="form-group">
143 <div class="checkbox">
144 <label for="createInListEnd">
145 <input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" />
149 <div class="checkbox">
150 <label for="hidePages">
151 <input type="checkbox" name="hidePages" id="hidePages" value="1" />
155 <div class="checkbox">
156 <label for="hidePagesInMenus">
157 <input type="checkbox" name="hidePagesInMenus" id="hidePagesInMenus" value="1" />
162 <div class="form-group">
163 <input class="btn btn-default" type="submit" name="create" value="' . $this->
getLanguageService()->getLL(
'wiz_newPages_lCreate') .
'" />
164 <input class="btn btn-default" type="reset" value="' . $this->
getLanguageService()->getLL(
'wiz_newPages_lReset') .
'" />
168 $this->
getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/WizardCrpages/WizardCreatePages');
170 $inlineJavaScriptCode =
'var tpl = "' . addslashes(str_replace(array(LF, TAB), array(
'',
''), $this->
getFormLine(
'#'))) .
'", i, line, div, bg, label;';
171 $this->
getPageRenderer()->addJsInlineCode(
'wizard_crpages', $inlineJavaScriptCode);
177 $theCode .=
BackendUtility::cshItem(
'_MOD_web_func',
'tx_wizardcrpages', null,
'<div class="t3-help">|</div>');
179 $out .=
'<div>' . $theCode .
'</div>';
191 if (is_numeric($index)) {
199 '<div class="form-section" id="form-line-' . $index .
'">' .
200 '<div class="row">' .
201 '<div class="form-group col-sm-6">' .
202 '<label for="page_new_' . $index .
'">' .
205 '<div class="form-control-wrap">' .
206 '<input class="form-control" type="text" id="page_new_' . $index .
'" name="data[pages][NEW' . $index .
'][title]" />' .
209 '<div class="form-group col-sm-6">' .
213 '<div class="form-control-wrap">' .
214 '<div class="input-group">' .
215 '<div id="page_new_icon_' . $index .
'" class="input-group-addon input-group-icon">' .
216 $this->iconFactory->getIconForRecord(
'pages', array(),
Icon::SIZE_SMALL)->render() .
218 '<select class="form-control form-control-adapt t3js-wizardcrpages-select-doktype" name="data[pages][NEW' . $index .
'][doktype]" data-target="#page_new_icon_' . $index .
'">' .
219 $this->typeSelectHtml .
240 unset($types[
'default']);
241 $types = array_keys($types);
246 $removeItems = isset($this->pagesTsConfig[
'doktype.'][
'removeItems']) ?
GeneralUtility::trimExplode(
',', $this->pagesTsConfig[
'doktype.'][
'removeItems'],
true) : array();
247 $allowedDoktypes = array_diff($types, $removeItems);
250 $availableDoktypes =
$GLOBALS[
'TCA'][
'pages'][
'columns'][
'doktype'][
'config'][
'items'];
253 $groupedData = array();
254 foreach ($availableDoktypes as $doktypeData) {
256 if ($doktypeData[1] ==
'--div--') {
257 $groupLabel = $doktypeData[0];
259 if (in_array($doktypeData[1], $allowedDoktypes)) {
260 $groupedData[$groupLabel][] = $doktypeData;
266 foreach ($groupedData as $groupLabel => $items) {
268 foreach ($items as $item) {
272 $groupContent .=
'<option value="' . htmlspecialchars($value) .
'" data-icon="' . htmlspecialchars($icon) .
'">' . $label .
'</option>';
275 $content .=
'<optgroup label="' . $groupLabel .
'">' . $groupContent .
'</optgroup>';