This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
typo3_sitepackage_contentelements [2015/10/07 10:56] – [Setup new content element] 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 to include it: | ||
- | <code typoscript> | ||
- | < | ||
</ | </ | ||
+ | ==== Add and modify TCA ==== | ||
- | <code php ext_tables.php> | ||
- | # FELDER VON TEXTPIC ÜBERNEHMEN ... | + | <code php Configuration/ |
- | $TCA[' | + | |
- | + | // Adds the content element to the " | |
- | $backupCTypeItems = $GLOBALS[' | + | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility:: |
- | $GLOBALS[' | + | |
array( | array( | ||
- | 'Slider', | + | 'Name in dropdown', |
- | '--div--' | + | 'myextkey_elementname', |
+ | ' | ||
), | ), | ||
- | | + | 'CType', |
- | | + | 'myextkey' |
- | 'slider', | + | |
- | ' | + | |
- | ) | + | |
); | ); | ||
- | foreach($backupCTypeItems as $key => $value){ | + | |
- | $GLOBALS[' | + | // 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> | ||
+ | # Add template path for your extension | ||
+ | lib.contentElement { | ||
+ | templateRootPaths { | ||
+ | 200 = EXT: | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # 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[' | ||
+ | </ | ||
+ |