Click here to load reader
View
4.809
Download
4
Embed Size (px)
TCA nderungenin TYPO3 6.2
am Beispiel einer Erweiterung der News Extension
bisherige Situation Erweiterungen in ext_tables.php
Kein Code Cache
ext_tables.php wird zur Laufzeit mehrfach eingelesen
Unbersichtlich. nderungen knnen sich leicht gegenseitig berschreiben.
Configuration/TCA/Overrides
Eingefhrt mit TYPO3 6.2
Beliebiger Dateiname
Beliebig viele Dateien mglich
Best practice:/Configuration/TCA/Overrides/.php
Vorteile
klar definierte Stelle, wo nderungen passieren
TCA nderungen landen im Code Cache
ext_tables.php wird entschlackt
Performance Gewinn im Backend wenn alle Extensions das Feature nutzen
Beispiele Systemextensions
css_styled_content
saltedpasswords
felogin
news_exampleextension
News erweitern
Neue News Typen und ein neues Feld
Struktur Extbase Verzeichnisstruktur
Resources/Private/extend-news.txt
enthlt Pfade zu den Dateien, die erweitert werden sollen
Ohne Dateiendung .php
Beispiel: Domain/Model/News
Configuration/TCA/Overrides/ tx_news_domain_model_news.php
if (ExtensionManagementUtility::isLoaded('news')) {
// register new news types $GLOBALS['TCA']['tx_news_domain_model_news']['types']['blogText'] =
$GLOBALS['TCA']['tx_news_domain_model_news']['types']['0'];
$GLOBALS['TCA']['tx_news_domain_model_news']['types']['blogImage'] = $GLOBALS['TCA']['tx_news_domain_model_news']['types']['0'];
// add individual type icons $GLOBALS['TCA']['tx_news_domain_model_news']['ctrl']['typeicons']['blogText'] =
ExtensionManagementUtility::extRelPath('news_exampleextension') . 'Resources/Public/Icons/news_domain_model_news_blogText.png';
$GLOBALS['TCA']['tx_news_domain_model_news']['ctrl']['typeicons']['blogImage'] = ExtensionManagementUtility::extRelPath('news_exampleextension') . 'Resources/Public/Icons/news_domain_model_news_blogImage.png';
// add author profile only to above registered news types ExtensionManagementUtility::addTCAcolumns(
'tx_news_domain_model_news', $tempColumns
);
ExtensionManagementUtility::addToAllTCAtypes( 'tx_news_domain_model_news', 'authorprofile;;;;1-1-1', 'blogText,blogImage', 'after:related_from'
); }
Configuration/TSconfig/Page/mod.tx_news_domain_model_news.txt
TCEFORM.tx_news_domain_model_news.type.addItems {
blogText = LLL:EXT:news_exampleextension/Resources/Private/Language/ locallang_db.xlf:tx_newsexampleextension_domain_model_news.type.blogText
blogImage = LLL:EXT:news_exampleextension/Resources/Private/Language/ locallang_db.xlf:tx_newsexampleextension_domain_model_news.type.blogImage
}
Classes/Domain/Model/NewsBlogText.php
Configuration/TypoScript/setup.txt
config.tx_extbase.persistence.classes { Tx_News_Domain_Model_News { subclasses { blogText = KWS\NewsExampleextension\Domain\Model\NewsBlogText blogImage = KWS\NewsExampleextension\Domain\Model\NewsBlogImage } }
KWS\NewsExampleextension\Domain\Model\NewsBlogText { mapping { recordType = blogText tableName = tx_news_domain_model_news } }
KWS\NewsExampleextension\Domain\Model\NewsBlogImage { mapping { recordType = blogImage tableName = tx_news_domain_model_news } } }
Configuration/TCA/Overrides/ tt_content.php
Fluid Template {newsItem.type}
enthlt neue Typen
blogText
blogImage
{newsItem.authorprofile}
enhlt uid der Seite
Ressourcen
https://forge.typo3.org/issues/57942
http://ab-softlab.tumblr.com/post/90851249969/tca-manipulation-in-typo3-6-2
https://github.com/peterkraume/news_exampleextension
https://forge.typo3.org/issues/57942http://ab-softlab.tumblr.com/post/90851249969/tca-manipulation-in-typo3-6-2https://github.com/peterkraume/news_exampleextension
Vielen Dank
@Cybersmog
http://de.slideshare.net/pk77
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
http://creativecommons.org/licenses/by-sa/4.0/