SlideShare ist ein Scribd-Unternehmen logo
1 von 10
TCA
 TYPO3 Configuration Array
 benutzerfreundlich einrichten




Peter Schuhmann, Dynamic Lines GmbH
zusätzliches Label immer anzeigen
ext_tables.php
'label'     => 'lastname',
'label_alt'       => 'firstname',
'label_alt_force' => TRUE,




Ergebnis




Peter Schuhmann, Dynamic Lines GmbH
Tabs verwenden
ext_tables.php
'dividers2tabs' => TRUE,




tca.php
'types' => array(
         '0' => array('showitem' => 'hidden;;1;;1-1-1, ctype , lastname, ,--div--;Address,address, street, zip, city')
),

Ein Tab wird mit „--div--;<tabname>,“ deklariert. Für <tabname> kann auch auf Locallang zugegriffen werden. Wird der erste
Tab nicht manuell festgelegt, wird dieser als „General“ festgelegt.



                                                             Ergebnis




Peter Schuhmann, Dynamic Lines GmbH
Hidden Fields
Das TCA bietet kein direktes Feld, welches als Hidden Field deklariert werden kann. Da im TCA unter types festgelegten
Felder die Sichtbarkeit der Felder steuert, kann man das Feld, welches nicht angezeigt werden soll einfach aus der Typ-
Deklaration entfernen. Mittels Hook kann das Feld dann nach wie vor beschrieben werden.


Beispiel
Ein Hidden Field kann beispielsweise genutzt werden um eine eigene Darstellung im Listen-Modul zu ermöglichen. Dieses Feld
kann dann als Label für die Tabelle genutzt werden um Redakteuren den Zugriff zu vereinfachen. Beispielsweise kann so neben
dem Vor- und Nachnamen auch der Firmenname mit ausgegeben werden.




Peter Schuhmann, Dynamic Lines GmbH
Types einrichten
tca.php
$TCA['<tabelname>'] = array(
         'ctrl' => $TCA['<tabelname>']['ctrl'],
         'interface' => array(
                  'showRecordFieldList' => 'hidden,firstname,lastname,address,street,zip,city,ctype'
         ),
         'feInterface' => $TCA['<tabelname>']['feInterface'],
'columns' => array(
...
                  'ctype' => array(
                            'exclude' => 0,
                            'label' => 'LLL:EXT:<extname>/locallang_db.xml:tx_<extname>_order.ctype',
                            'config' => array(
                                     'type' => 'select',
                                     'items' => array(
/* Label der unterschiedlichen Typen */
                                               array('LLL:EXT:<extname>/locallang_db.xml:tx_<extname>_order.ctype.I.0',
'0'),
                                               array('LLL:EXT:<extname>/locallang_db.xml:tx_<extname>_order.ctype.I.1',
'1'),
                                     ),
                                     'size' => 1,
                                     'maxitems' => 1,
                            )
)
...
)
         'types' => array(
/* Welche Felder sollen bei welchem Typen angezeigt werden (Reihenfolge entscheidend) (0 = Default) */
                  '0' => array('showitem' => 'hidden;;1;;1-1-1, ctype , lastname,address, street, zip, city'),
                  '1' => array('showitem' => 'hidden;;1;;1-1-1, ctype, lastname')
         ),
         'palettes' => array(
                  '1' => array('showitem' => '')
         )
);

Peter Schuhmann, Dynamic Lines GmbH
                    )                                         5
Types einrichten
ext_tables.php
'type' => 'ctype',

Mit diesem Befehl wird angegeben, welches Feld für die Typumschaltung zuständig ist. Ändert sich der Wert dieses Feldes,
wird die Seite neugeladen. In diesem Fall lautet der Name des Feldes ctype.



Ergebnis




Peter Schuhmann, Dynamic Lines GmbH
IRRE
Vorteil
Leichte Pflege der Daten für den Anwender. Die Daten befinden sich dort, wo man sie erwartet.




                                                                       Nachteil
Angelegte Kindelemente werden in der Listenansicht
angezeigt. Bearbeitet der Anwender einen Kinddatensatz
direkt, wird die Eltern-ID entfernt und der Kinddatensatz
wird zum Hauptdatensatz.




Peter Schuhmann, Dynamic Lines GmbH
IRRE
Lösung
In der Datei „typo3/class.db_list.inc“ - die für die Ausführung der Datenbankabfrage der Listenansicht verantwortlich ist -
befindet sich ein Hook, mit welchem die Darstellung angepasst werden kann. Alternativ die Extension „tca_addWhere“ aus
dem Repository laden (wird die nächsten Tage online gestellt).

ext_localconf.php
$TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list.inc']['makeQueryArray'][] =
'EXT:tca_addWhere/class.tx_tcaaddwhere_hook.php:tx_tcaaddwhere_hook';




class.tx_tcaaddwhere_hook.php
<?php
class tx_tcaaddwhere_hook {

         public function makeQueryArray_post(&$queryParts, $piObj, $table, $id, $addWhere, $fieldList, $_params) {

                   if ($table == 'tx_demo_domain_model_category') {
                   $queryParts['WHERE'] .= ' AND parentcategory = 0';
                   }
         }
}
?>                                                                      Ergebnis


Peter Schuhmann, Dynamic Lines GmbH
Treeview rendern
   tca.php
            'category' => array(
                      'exclude' => 1,
                      'label' =>
XT:demo/Resources/Private/Language/locallang_db.xml:tx_demo_domain_model_course.category',
                      'config' => array(
                               'type' => 'select',
                               'foreign_table' => 'tx_demo_domain_model_category',
                               'MM' => 'tx_demo_course_category_mm',
                               'size' => 10,

                                                                                  Ergebnis
                               'autoSizeMax' => 30,
                               'maxitems' => 9999,
                               'multiple' => 0,
                               'renderMode' => 'tree',
                               'treeConfig' => array(
                                         'parentField' => 'parentcategory',
                                         'appearance' => array(
                                                  'expandAll' => TRUE,
                                                  'showHeader' => TRUE,
                                                  'maxLevels' => 999,
                                         )
                               )
                      ),
            ),



   Voraussetzung ist, dass die Tabelle tx_demo_domain_model_category auf sich
   selbst verweist.




  Peter Schuhmann, Dynamic Lines GmbH
Links
Core Documentation
http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.1.0/view/4/2/




Feedback
Peter.Schuhmann@dynamiclines.de




Peter Schuhmann, Dynamic Lines GmbH

Weitere ähnliche Inhalte

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

TYPO3 TCA benutzerfreundlich einrichten

  • 1. TCA TYPO3 Configuration Array benutzerfreundlich einrichten Peter Schuhmann, Dynamic Lines GmbH
  • 2. zusätzliches Label immer anzeigen ext_tables.php 'label' => 'lastname', 'label_alt' => 'firstname', 'label_alt_force' => TRUE, Ergebnis Peter Schuhmann, Dynamic Lines GmbH
  • 3. Tabs verwenden ext_tables.php 'dividers2tabs' => TRUE, tca.php 'types' => array( '0' => array('showitem' => 'hidden;;1;;1-1-1, ctype , lastname, ,--div--;Address,address, street, zip, city') ), Ein Tab wird mit „--div--;<tabname>,“ deklariert. Für <tabname> kann auch auf Locallang zugegriffen werden. Wird der erste Tab nicht manuell festgelegt, wird dieser als „General“ festgelegt. Ergebnis Peter Schuhmann, Dynamic Lines GmbH
  • 4. Hidden Fields Das TCA bietet kein direktes Feld, welches als Hidden Field deklariert werden kann. Da im TCA unter types festgelegten Felder die Sichtbarkeit der Felder steuert, kann man das Feld, welches nicht angezeigt werden soll einfach aus der Typ- Deklaration entfernen. Mittels Hook kann das Feld dann nach wie vor beschrieben werden. Beispiel Ein Hidden Field kann beispielsweise genutzt werden um eine eigene Darstellung im Listen-Modul zu ermöglichen. Dieses Feld kann dann als Label für die Tabelle genutzt werden um Redakteuren den Zugriff zu vereinfachen. Beispielsweise kann so neben dem Vor- und Nachnamen auch der Firmenname mit ausgegeben werden. Peter Schuhmann, Dynamic Lines GmbH
  • 5. Types einrichten tca.php $TCA['<tabelname>'] = array( 'ctrl' => $TCA['<tabelname>']['ctrl'], 'interface' => array( 'showRecordFieldList' => 'hidden,firstname,lastname,address,street,zip,city,ctype' ), 'feInterface' => $TCA['<tabelname>']['feInterface'], 'columns' => array( ... 'ctype' => array( 'exclude' => 0, 'label' => 'LLL:EXT:<extname>/locallang_db.xml:tx_<extname>_order.ctype', 'config' => array( 'type' => 'select', 'items' => array( /* Label der unterschiedlichen Typen */ array('LLL:EXT:<extname>/locallang_db.xml:tx_<extname>_order.ctype.I.0', '0'), array('LLL:EXT:<extname>/locallang_db.xml:tx_<extname>_order.ctype.I.1', '1'), ), 'size' => 1, 'maxitems' => 1, ) ) ... ) 'types' => array( /* Welche Felder sollen bei welchem Typen angezeigt werden (Reihenfolge entscheidend) (0 = Default) */ '0' => array('showitem' => 'hidden;;1;;1-1-1, ctype , lastname,address, street, zip, city'), '1' => array('showitem' => 'hidden;;1;;1-1-1, ctype, lastname') ), 'palettes' => array( '1' => array('showitem' => '') ) ); Peter Schuhmann, Dynamic Lines GmbH ) 5
  • 6. Types einrichten ext_tables.php 'type' => 'ctype', Mit diesem Befehl wird angegeben, welches Feld für die Typumschaltung zuständig ist. Ändert sich der Wert dieses Feldes, wird die Seite neugeladen. In diesem Fall lautet der Name des Feldes ctype. Ergebnis Peter Schuhmann, Dynamic Lines GmbH
  • 7. IRRE Vorteil Leichte Pflege der Daten für den Anwender. Die Daten befinden sich dort, wo man sie erwartet. Nachteil Angelegte Kindelemente werden in der Listenansicht angezeigt. Bearbeitet der Anwender einen Kinddatensatz direkt, wird die Eltern-ID entfernt und der Kinddatensatz wird zum Hauptdatensatz. Peter Schuhmann, Dynamic Lines GmbH
  • 8. IRRE Lösung In der Datei „typo3/class.db_list.inc“ - die für die Ausführung der Datenbankabfrage der Listenansicht verantwortlich ist - befindet sich ein Hook, mit welchem die Darstellung angepasst werden kann. Alternativ die Extension „tca_addWhere“ aus dem Repository laden (wird die nächsten Tage online gestellt). ext_localconf.php $TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list.inc']['makeQueryArray'][] = 'EXT:tca_addWhere/class.tx_tcaaddwhere_hook.php:tx_tcaaddwhere_hook'; class.tx_tcaaddwhere_hook.php <?php class tx_tcaaddwhere_hook { public function makeQueryArray_post(&$queryParts, $piObj, $table, $id, $addWhere, $fieldList, $_params) { if ($table == 'tx_demo_domain_model_category') { $queryParts['WHERE'] .= ' AND parentcategory = 0'; } } } ?> Ergebnis Peter Schuhmann, Dynamic Lines GmbH
  • 9. Treeview rendern tca.php 'category' => array( 'exclude' => 1, 'label' => XT:demo/Resources/Private/Language/locallang_db.xml:tx_demo_domain_model_course.category', 'config' => array( 'type' => 'select', 'foreign_table' => 'tx_demo_domain_model_category', 'MM' => 'tx_demo_course_category_mm', 'size' => 10, Ergebnis 'autoSizeMax' => 30, 'maxitems' => 9999, 'multiple' => 0, 'renderMode' => 'tree', 'treeConfig' => array( 'parentField' => 'parentcategory', 'appearance' => array( 'expandAll' => TRUE, 'showHeader' => TRUE, 'maxLevels' => 999, ) ) ), ), Voraussetzung ist, dass die Tabelle tx_demo_domain_model_category auf sich selbst verweist. Peter Schuhmann, Dynamic Lines GmbH