This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
typo3_sitepackage_contentelements [2015/10/07 10:16] – created admin | typo3_sitepackage_contentelements [2018/09/28 07:53] (current) – admin | ||
---|---|---|---|
Line 5: | Line 5: | ||
Why using a Site Package: http:// | Why using a Site Package: http:// | ||
- | Code by Example: https://github.com/benjaminkott/example_package | + | See: https://docs.typo3.org/ |
===== Adding new Content elements to your Site Package ===== | ===== Adding new Content elements to your Site Package ===== | ||
- | |||
- | Manual to get started: | ||
- | http:// | ||
==== Setup new content element ==== | ==== Setup new content element ==== | ||
- | <code typoscript Configuration/ | + | This will show your new element in the content element wizard |
- | #### ELEMENT IN WIZARD MIT AUFNEHMEN | + | |
- | mod.wizards.newContentElement.wizardItems | + | <code typoscript Configuration/ |
- | | + | # Custom Contentelements based on fluid |
- | | + | mod.wizards.newContentElement.wizardItems.common { |
- | slider | + | elements { |
- | title = SLIDER ODER???? | + | myextkey_elementname |
- | description = Macht nen total fetzigen Slider | + | |
- | icon = gfx/ | + | |
- | | + | description = Describe what this element is supposed to do |
- | CType = slider | + | tt_content_defValues { |
- | } | + | CType = myextkey_elementname |
- | } | + | } |
- | } | + | |
- | show := addToList(slider) | + | |
} | } | ||
+ | } | ||
+ | show := addToList(myextkey_elementname) | ||
} | } | ||
+ | |||
</ | </ | ||
- | Dont forget | + | ==== Add and modify TCA ==== |
+ | |||
+ | |||
+ | <code php Configuration/ | ||
+ | |||
+ | // Adds the content element | ||
+ | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility:: | ||
+ | array( | ||
+ | 'Name in dropdown', | ||
+ | ' | ||
+ | ' | ||
+ | ), | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | // Add a custom palette | ||
+ | $GLOBALS[' | ||
+ | ' | ||
+ | ' | ||
+ | ]; | ||
+ | |||
+ | // Configure the default backend fields for the content element | ||
+ | $GLOBALS[' | ||
+ | ' | ||
+ | --div--; | ||
+ | | ||
+ | | ||
+ | --div--; | ||
+ | --div--; | ||
+ | | ||
+ | --div--; | ||
+ | | ||
+ | | ||
+ | ', | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ] | ||
+ | ] | ||
+ | ] | ||
+ | ); | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Add a template path ==== | ||
+ | |||
+ | < | ||
+ | lib.contentElement { | ||
+ | | ||
+ | 200 = EXT: | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Configure template ==== | ||
<code typoscript> | <code typoscript> | ||
- | < | + | # Add template path for your extension |
+ | lib.contentElement { | ||
+ | templateRootPaths { | ||
+ | 200 = EXT:myextkey/Resources/Private/Templates/ | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # Load defaults and define Template | ||
+ | tt_content { | ||
+ | myextkey_elementname =< lib.contentElement | ||
+ | myextkey_elementname { | ||
+ | templateName = NameOfYourTemplate | ||
+ | } | ||
+ | } | ||
</ | </ | ||
+ | |||
+ | Depending on which contentelement this is based on you can simply load. | ||
+ | |||
+ | For example this element should be based on '' | ||
+ | |||
+ | <code typoscript> | ||
+ | tt_content { | ||
+ | myextkey_elementname =< tt_content.image | ||
+ | myextkey_elementname { | ||
+ | templateName = NameOfYourTemplate | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | You'll find all available CEs in '' | ||
+ | |||
+ | ==== Config field for certain cType ==== | ||
+ | |||
+ | <code php> | ||
+ | $GLOBALS[' | ||
+ | $GLOBALS[' | ||
+ | </ | ||
+ |