Advertisement
Mr_media

TYPO3 Extension-Container-setup

Oct 31st, 2023 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.19 KB | None | 0 0
  1. ####### Set-up for extension container to migrate from grid-elements
  2. TYPO3 10.4.37 in process to upgrade to v11
  3. Latest version of container extension
  4. All files are in a site_packages extension
  5.  
  6. Steps followed to be able to Migrate from Gridelements:
  7. 1. created all template-files, TCA-containers Container Settings, using the same naming and colPos as in the original Gridelements.
  8. - The original gridelements where not using id's for the BackenLayout, but had their "alias" names instead.
  9. 2. run these commands in phpMyadmin:
  10.  
  11. UPDATE `tt_content` SET `CType`=CONCAT('container-', `tx_gridelements_backend_layout`) WHERE `CType`='gridelements_pi1';
  12.  
  13.  
  14. UPDATE `tt_content` SET `colPos`= `tx_gridelements_columns`,`tx_container_parent`=`tx_gridelements_container` WHERE `colPos`=-1;
  15.  
  16. Run upgrade in the BE-Tools
  17.  
  18. Removed Gridelements
  19.  
  20. ######## result
  21. - duplicated CE (seems to be a copy or linked with the container
  22. - some templates seemd to be wrong and had to be changed to the right (eddited) one manually
  23. - In frontend getting error no rendering definition for...
  24. - ERROR: Content Element with uid "221" and type "container-2_columns" has no rendering definition!
  25. _ indicates that the template is not found or not correct coded ...
  26.  
  27.  
  28. ############### The TCA Override php ##################
  29. ###########################################################
  30.  
  31. <?php
  32. /*
  33. *
  34. *
  35. */
  36.  
  37. if (!defined('TYPO3')) {
  38. die('Access denied.');
  39. }
  40.  
  41. /* container 2 kolommen */
  42.  
  43. call_user_func(function () {
  44. \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
  45. (
  46. new \B13\Container\Tca\ContainerConfiguration(
  47. 'container-2_columns', // CType
  48. '2 Column Element', // label
  49. '2 Column Element', // description
  50. [
  51. [
  52. ['name' => 'Linker Colom', 'colPos' => 0],
  53. ['name' => 'Rechter Colom', 'colPos' => 1]
  54. ]
  55. ] // grid configuration
  56. )
  57. )
  58. // set an optional icon configuration
  59. ->setIcon('EXT:container/Resources/Public/Icons/container-2col.svg')
  60. );
  61.  
  62.  
  63. /* container 3 kolommen */
  64. \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
  65. (
  66. new \B13\Container\Tca\ContainerConfiguration(
  67. 'container-3_columns', // CType
  68. '3 Column Element', // label
  69. '3 Column Element', // description
  70. [
  71. [
  72. ['name' => 'Linker Colom', 'colPos' => 1],
  73. ['name' => 'Midden Colom', 'colPos' => 2],
  74. ['name' => 'Rechter Colom', 'colPos' => 3]
  75. ]
  76. ] // grid configuration
  77. )
  78. )
  79. // set an optional icon configuration
  80. ->setIcon('EXT:container/Resources/Public/Icons/container-2col.svg')
  81. );
  82.  
  83.  
  84. /* container 40 / 60 kolommen */
  85.  
  86. \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
  87. (
  88. new \B13\Container\Tca\ContainerConfiguration(
  89. 'container-columns_40_60', // CType
  90. 'columns_40_60', // label
  91. 'columns_40_60', // description
  92. [
  93. [
  94. ['name' => 'Linker inhoud', 'colPos' => 0],
  95. ['name' => 'Rechter inhoud', 'colPos' => 1]
  96. ]
  97. ] // grid configuration
  98. )
  99. )
  100. // set an optional icon configuration
  101. ->setIcon('EXT:container/Resources/Public/Icons/container-3col.svg')
  102. );
  103.  
  104. /* container 4 kolommen */
  105.  
  106. \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
  107. (
  108. new \B13\Container\Tca\ContainerConfiguration(
  109. 'container-4cols', // CType
  110. '4 Colommen Element', // label
  111. '4 Colommen Element Voor Content', // description
  112. [
  113. [
  114. ['name' => 'Linker Colom', 'colPos' => 1],
  115. ['name' => 'Midden Eerste Colom', 'colPos' => 2],
  116. ['name' => 'Midden tweede Colom', 'colPos' => 3],
  117. ['name' => 'Rechter Colom', 'colPos' => 4],
  118. ]
  119. ] // grid configuration
  120. )
  121. )
  122. // set an optional icon configuration
  123. ->setIcon('EXT:container/Resources/Public/Icons/container-4col.svg')
  124. );
  125.  
  126. /* container 1 kolom */
  127.  
  128. \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
  129. (
  130. new \B13\Container\Tca\ContainerConfiguration(
  131. 'container-1_column', // CType
  132. '1 Column Element', // label
  133. '1 Column Element', // description
  134. [
  135. [
  136. ['name' => '1_column', 'colPos' => 1],
  137. ]
  138. ] // grid configuration
  139. )
  140. )
  141. // set an optional icon configuration
  142. ->setIcon('EXT:container/Resources/Public/Icons/container-1col.svg')
  143. );
  144.  
  145. /* container standaard section */
  146.  
  147. \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
  148. (
  149. new \B13\Container\Tca\ContainerConfiguration(
  150. 'container-section_element', // CType
  151. 'Default Section Element', // label
  152. 'Default Section voor content', // description
  153. [
  154. [
  155. ['name' => 'ContentColom', 'colPos' => 0],
  156. ]
  157. ] // grid configuration
  158. )
  159. )
  160. // set an optional icon configuration
  161. ->setIcon('EXT:container/Resources/Public/Icons/container-1col.svg')
  162. );
  163.  
  164.  
  165. /* container section met 1 kolom */
  166.  
  167. \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
  168. (
  169. new \B13\Container\Tca\ContainerConfiguration(
  170. 'container-section_1_col', // CType
  171. 'Section Element', // label
  172. 'Section voor content', // description
  173. [
  174. [
  175. ['name' => 'ContentColom met 1 Kolom er in', 'colPos' => 0],
  176. ]
  177. ] // grid configuration
  178. )
  179. )
  180. // set an optional icon configuration
  181. ->setIcon('EXT:container/Resources/Public/Icons/container-1col.svg')
  182. );
  183.  
  184.  
  185. /* container met achtergrond afbeelding -- aanpassen template met {variable uit constants en of afbeelding path } */
  186.  
  187. \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
  188. (
  189. new \B13\Container\Tca\ContainerConfiguration(
  190. 'container-section_element_background_img', // CType
  191. 'Section With Background', // label
  192. 'Section Met achtergrond afbeelding', // description
  193. [
  194. [
  195. ['name' => 'ContentColumn With Background Image', 'colPos' => 0],
  196. ]
  197. ] // grid configuration
  198. )
  199. )
  200. // set an optional icon configuration
  201. ->setIcon('EXT:container/Resources/Public/Icons/container-1col.svg')
  202. );
  203. });
  204.  
  205. ################### The setup_container typoscript ############
  206. #################################################################
  207. ########### container 2 kolommen ##########
  208.  
  209. tt_content.container-2_columns < lib.contentElement
  210. tt_content.container-2_columns {
  211. templateName = 2ColsContainer
  212. templateRootPaths {
  213. 10 = EXT:hocomtemplate/Resources/Private/Extensions/container/Templates/
  214. }
  215. dataProcessing {
  216. 100 = B13\Container\DataProcessing\ContainerProcessor
  217. }
  218. }
  219.  
  220.  
  221. ########### container 40 /60 kolom indeling ##########
  222.  
  223. tt_content.container-columns_40_60 < lib.contentElement
  224. tt_content.container-columns_40_60 {
  225. templateName = Columns_40_60
  226. templateRootPaths {
  227. 10 = EXT:hocomtemplate/Resources/Private/Extensions/container/Templates/
  228. }
  229. dataProcessing {
  230. 100 = B13\Container\DataProcessing\ContainerProcessor
  231. }
  232. }
  233.  
  234.  
  235. ########### container 3 kolommen ##########
  236.  
  237. tt_content.container-3_columns < lib.contentElement
  238. tt_content.container-3_columns {
  239. templateName = 3ColsContainer
  240. templateRootPaths {
  241. 10 = EXT:hocomtemplate/Resources/Private/Extensions/container/Templates/
  242. }
  243. dataProcessing {
  244. 100 = B13\Container\DataProcessing\ContainerProcessor
  245. }
  246. }
  247.  
  248. ########### container 4 kolommen ##########
  249.  
  250. tt_content.container-4cols < lib.contentElement
  251. tt_content.container-4cols {
  252. templateName = 4ColsContainer
  253. templateRootPaths {
  254. 10 = EXT:hocomtemplate/Resources/Private/Extensions/container/Templates/
  255. }
  256. dataProcessing {
  257. 100 = B13\Container\DataProcessing\ContainerProcessor
  258. }
  259. }
  260.  
  261. ########### container section ##########
  262.  
  263. tt_content.section-section_element < lib.contentElement
  264. tt_content.section-section_elementl {
  265. templateName = SectionContainer1
  266. templateRootPaths {
  267. 10 = EXT:hocomtemplate/Resources/Private/Extensions/container/Templates/
  268. }
  269. dataProcessing {
  270. 100 = B13\Container\DataProcessing\ContainerProcessor
  271. }
  272. }
  273.  
  274. ########### container 1 kolommen ##########
  275.  
  276. tt_content.container-1_column < lib.contentElement
  277. tt_content.container-1_column {
  278. templateName = 1ColContainer
  279. templateRootPaths {
  280. 10 = EXT:hocomtemplate/Resources/Private/Extensions/container/Templates/
  281. }
  282. dataProcessing {
  283. 100 = B13\Container\DataProcessing\ContainerProcessor
  284. }
  285. }
  286.  
  287.  
  288.  
  289. ########### container section met 1 kolom ##########
  290.  
  291. tt_content.section-section_1_col < lib.contentElement
  292. tt_content.section-section_1_col {
  293. templateName = Section_1_col
  294. templateRootPaths {
  295. 10 = EXT:hocomtemplate/Resources/Private/Extensions/container/Templates/
  296. }
  297. dataProcessing {
  298. 100 = B13\Container\DataProcessing\ContainerProcessor
  299. }
  300. }
  301.  
  302.  
  303.  
  304. ########### container section met 1 kolom en achtergrond afbeelding ##########
  305.  
  306. tt_content.section-section_element_background_img < lib.contentElement
  307. tt_content.section-section_element_background_img {
  308. templateName = Section_1_col_Background_Img
  309. templateRootPaths {
  310. 10 = EXT:hocomtemplate/Resources/Private/Extensions/container/Templates/
  311. }
  312. dataProcessing {
  313. 100 = B13\Container\DataProcessing\ContainerProcessor
  314. }
  315. }
  316.  
  317.  
  318. ############ sample template #########################################
  319. ########################################################################
  320.  
  321. <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
  322. <!-- 2 columns 50 / 50 for content side by side -->
  323. <div class="row">
  324. <div class="small-12 medium-6 large-6 columns">
  325. <f:for each="{children-0}" as="record">
  326.  
  327. <f:format.raw>
  328. {record.renderedContent}
  329. </f:format.raw>
  330.  
  331. </f:for>
  332.  
  333. </div>
  334.  
  335. <div class="small-12 medium-6 large-6 columns">
  336. <f:for each="{children-1}" as="record">
  337.  
  338. <f:format.raw>
  339. {record.renderedContent}
  340. </f:format.raw>
  341.  
  342. </f:for>
  343. </div>
  344.  
  345. </div>
  346. </html>
  347.  
  348. ####################################################################################
  349.  
  350.  
  351.  
  352.  
  353.  
Tags: TYPO3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement