Add new field to extension table
Example for extension rtgdictionary.
ext_tables.sql
Add a new field to SQL table (marked with red color). You must update extension in Extension manager in function Information.
#
# Table structure for table 'tx_rtgdictionary_terms'
#
CREATE TABLE tx_rtgdictionary_terms (
...
file blob NOT NULL,
author int(11) DEFAULT '0' NOT NULL,
status int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
KEY parent (pid)
);
ext_tables.php
$TCA["tx_rtgdictionary_terms"] = array (
...
"feInterface" => array (
"fe_admin_fieldList" => "term, category, description, image, file, author, status",
)
);
locallang_db.xml, pi1/locallang.xml
Setup for default (english) and slovak language.
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<type>database</type>
<description>Language labels for database tables/fields belonging to extension 'rtgdictionary'</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
...
<label index="tx_rtgdictionary_terms.file">Document</label>
<label index="tx_rtgdictionary_terms.author">Author</label>
<label index="tx_rtgdictionary_terms.status">Status</label>
...
</languageKey>
<languageKey index="sk" type="array">
...
<label index="tx_rtgdictionary_terms.file">Dokument</label>
<label index="tx_rtgdictionary_terms.author">Autor</label>
<label index="tx_rtgdictionary_terms.status">Stav</label>
...
</languageKey>
</data>
</T3locallang>
tca.php
Add new field to TCA table. For setup column type see http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.1.0/view/4/2/#id3651270
$TCA["tx_rtgdictionary_terms"] = array (
...
"interface" => array (
"showRecordFieldList" => "term,category,description,image,file,author,status"
),
...
"columns" => array (
...
"author" => Array (
"exclude" => 1,
"label" => "LLL:EXT:rtgdictionary/locallang_db.xml:tx_rtgdictionary_terms.author",
"config" => Array (
"type" => "select",
"items" => Array (
Array("",0),
),
"foreign_table" => "fe_users",
"foreign_table_where" => "AND fe_users.pid=###STORAGE_PID### ORDER BY fe_users.uid",
"size" => 1,
"minitems" => 0,
"maxitems" => 1,
)
),
"status" => Array (
"exclude" => 1,
"label" => "LLL:EXT:rtgdictionary/locallang_db.xml:tx_rtgdictionary_terms.status",
"config" => Array (
"type" => "select",
"items" => Array (
Array("noactive", "0"),
Array("active", "1"),
),
"size" => 1,
"maxitems" => 1,
)
),
),
"types" => array (
"0" => array("showitem" => "term;;;;1-1-1, category, description, image, file, author, status")
),
...
);
pi1/template_1.html
Add field to HTML template in view SINGLE (detail).
<h2>Term detail view template (SINGLE)</h2>
<!-- ###SINGLE_TERM### begin -->
<table class="list">
<tbody>
<tr>
<th>###TERMS_TERM_TITLE###</th>
<td>###TERMS_TERM### (###TERMS_STATUS###)</td>
</tr>
<tr>
<th>###TERMS_CATEGORY_TITLE###</th>
<td>###TERMS_CATEGORY###</td>
</tr>
...
</tbody>
</table>
<!-- ###SINGLE_TERM### end -->
pi1/class.tx_rtgdictionary_pi1.php
Update class PI1 for rendering new field to subpart SINGLE (mark ###TERMS_STATUS###). Code row insert in function parseTemplateSingleTerm().
...
$marks['###TERMS_FILE###'] = $term['file'];
$marks['###TERMS_AUTHOR###'] = $term['author'];
$marks['###TERMS_STATUS###'] = $term['status'];
$marks['###TERMS_DESCRIPTION###'] = $term['description'];
...
| Žiadne dokumenty ani odkazy k tejto stránke. | ||
Generátor typoscriptu
Vytvára typoscript pre bežné použitie. Generátor je jednoduchý na obsluhu, stačí vyplniť zopár položiek formulára.