-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Add a basic content element
- Loading branch information
Showing
4 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
|
||
defined('TYPO3') or die(); | ||
|
||
call_user_func(function () { | ||
|
||
$key = 'examples_basiccontent'; | ||
|
||
// Adds the content element to the "Type" dropdown | ||
ExtensionManagementUtility::addTcaSelectItem( | ||
'tt_content', | ||
'CType', | ||
[ | ||
'label' => 'Example - basic content', | ||
'value' => $key, | ||
'group' => 'default', | ||
], | ||
'textmedia', | ||
'after', | ||
); | ||
|
||
// Configure the default backend fields for the content element | ||
$GLOBALS['TCA']['tt_content']['types'][$key] = [ | ||
'showitem' => ' | ||
--palette--;;headers, | ||
bodytext, | ||
', | ||
]; | ||
}); |
6 changes: 6 additions & 0 deletions
6
Configuration/TypoScript/CustomContentElements/Basic.typoscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
tt_content { | ||
examples_basiccontent =< lib.contentElement | ||
examples_basiccontent { | ||
templateName = BasicContent | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Resources/Private/Templates/ContentElements/BasicContent.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> | ||
<f:layout name="Default" /> | ||
<f:section name="Main"> | ||
|
||
<div class="examples-basic-content"> | ||
<f:format.nl2br> | ||
{data.bodytext} | ||
</f:format.nl2br> | ||
</div> | ||
|
||
</f:section> | ||
</html> |