55Customization Examples
66======================
77
8- Many extracts can be found throughout the manual , but this section
9- provides more complete examples.
8+ There are many customization examples in the documentation , but this section
9+ provides the most complete examples.
1010
1111
1212.. index ::
@@ -18,7 +18,7 @@ Example 1: Extending the fe\_users table
1818========================================
1919
2020The "examples" extension adds two fields to the "fe\_ users" table.
21- Here's the complete code, taken from file
21+ Here is the complete code, taken from file
2222:file: `Configuration/TCA/Overrides/fe_users.php `:
2323
2424.. code-block :: php
@@ -70,23 +70,22 @@ Read :ref:`why the check for the TYPO3 constant is necessary <globals-constants-
7070
7171.. note ::
7272
73- The second example :php: `tx_examples_special ` only works when the
74- :php: `renderType ` has been registered implemented and then registered in
75- the ext_localconf.php. Please refer to the the following chapter of the
76- TCA reference on how to implement it: :ref: `t3tca:columns-user `.
73+ The second example, :php: `tx_examples_special `, only works when
74+ :php: `renderType ` has been registered, implemented, and registered in
75+ ext_localconf.php. Please refer to :ref: `t3tca:columns-user `.
7776
7877
79- In this example the first method call adds fields using
80- :php: `ExtensionManagementUtility::addTCAcolumns() `. This ensures that the fields
81- are registered in :php: `$GLOBALS['TCA'] `. Parameters :
78+ The first method call adds fields using
79+ :php: `ExtensionManagementUtility::addTCAcolumns() `. This registers the fields
80+ in :php: `$GLOBALS['TCA'] `. The parameters are :
8281
83821. Name of the table to which the fields should be added.
84- 2. An array of the fields to be added. Each field is represented in the
83+ 2. An array of the fields to be added. Each field is in
8584 :ref: `TCA syntax for columns <t3tca:columns >`.
8685
87- Since the fields are only registered but not used anywhere, the fields are
88- afterwards added to the "types" definition of the :sql: `fe_users ` table by
89- calling :php: `ExtensionManagementUtility::addToAllTCAtypes() `. Parameters :
86+ At this point the fields have been registered but not used anywhere, so they need to be added
87+ to the "types" definition of the :sql: `fe_users ` table by
88+ calling :php: `ExtensionManagementUtility::addToAllTCAtypes() `. The parameters are :
9089
91901. Name of the table to which the fields should be added.
92912. Comma-separated string of fields, the same syntax used in the
@@ -97,19 +96,19 @@ calling :php:`ExtensionManagementUtility::addToAllTCAtypes()`. Parameters:
9796 to an existing field (:php: `after:myfield `) or
9897 palette (:php: `after:palette:mypalette `).
9998
100- So you could do this :
99+ Example code :
101100
102101.. literalinclude :: _fe_users.php
103102 :language: php
104103 :caption: EXT:some_extension/Configuration/TCA/Overrides/fe_users.php
105104
106- If the fourth parameter (position) is omitted or the specified field is not found,
107- new fields are added at the bottom of the form. If the table uses tabs,
108- new fields are added at the bottom of the :guilabel: `Extended ` tab. This tab
105+ If the fourth parameter is omitted or the field is not found,
106+ new fields are added to the bottom of the form. If the table uses tabs,
107+ new fields are added to the bottom of the :guilabel: `Extended ` tab. This tab
109108is created automatically if it does not exist.
110109
111- These method calls do not create the corresponding fields in the database. The new
112- fields must also be defined in the :file: `ext_tables.sql ` file of the extension:
110+ These method calls do not create fields in the database. To do
111+ this, the new fields must be defined in the :file: `ext_tables.sql ` file of the extension:
113112
114113.. code-block :: sql
115114 :caption: EXT:some_extension/ext_tables.sql
@@ -128,12 +127,12 @@ fields must also be defined in the :file:`ext_tables.sql` file of the extension:
128127 table already exists.
129128
130129
131- The following screen shot shows the placement of the two
130+ The following screenshot shows the position of the two
132131new fields when editing a "fe\_ users" record:
133132
134133.. include :: /Images/AutomaticScreenshots/ExtendingTca/ExtendingTcaFeUsers.rst.txt
135134
136- The next example shows how to place a field more precisely.
135+ The next example shows how to position a field more precisely.
137136
138137
139138.. index ::
@@ -144,7 +143,7 @@ The next example shows how to place a field more precisely.
144143Example 2: Extending the tt\_ content Table
145144==========================================
146145
147- In the second example, we will add a "No print" field to all content
146+ In this second example, we will add a "No print" field to all content
148147element types. First of all, we add its SQL definition in
149148:file: `ext_tables.sql `:
150149
@@ -186,16 +185,14 @@ Then we add it to the :php:`$GLOBALS['TCA']` in :file:`Configuration/TCA/Overrid
186185 'before:editlock'
187186 );
188187
189- The code is mostly the same as in the first example, but the last method call
190- is different and requires an explanation. The tables :code: `pages ` and
191- :code: `tt_content ` use :ref: `palettes <t3tca:palettes >` extensively. This increases
192- flexibility.
193-
194- Therefore we call :code: `ExtensionManagementUtility::addFieldsToPalette() `
188+ The code is similar to the first example, but the last method call
189+ is different. The tables :code: `pages ` and
190+ :code: `tt_content ` use :ref: `palettes <t3tca:palettes >` extensively. Therefore,
191+ we call :code: `ExtensionManagementUtility::addFieldsToPalette() `
195192instead of :code: `ExtensionManagementUtility::addToAllTCAtypes() `.
196- We need to specify the palette's key as the second argument (:code: `access `).
197- Precise placement of the new field is achieved with the fourth parameter
198- (:code: `before:editlock `). This will place the "no print" field right before the
193+ We need to specify the palette key as the second argument (:code: `access `).
194+ The new field is positioned by the fourth parameter
195+ (:code: `before:editlock `). This will position the "no print" field before the
199196:guilabel: `Restrict editing by non-Admins ` field, instead of putting it in the
200197:guilabel: `Extended ` tab.
201198
@@ -205,12 +202,11 @@ The result is the following:
205202
206203.. note ::
207204
208- Obviously this new field will not magically exclude a content element
209- from being printed. For it to have any effect, it must be used during
210- the rendering by modifying the TypoScript used to render the
211- :sql: `tt_content ` table. Although this is outside the scope of this
205+ Obviously this new field doesn't do anything yet. For it to do its job of
206+ excluding a content element from being printed, it must modify the TypoScript
207+ used to render the :sql: `tt_content ` table. Although this is outside the scope of this
212208 manual, here is an example of what you could do, for the sake of
213- showing a complete process.
209+ showing the complete process.
214210
215211 Assuming you are using "fluid\_ styled\_ content" (which is installed by
216212 default), you could add the following TypoScript to your template:
@@ -225,6 +221,6 @@ The result is the following:
225221 be to declare the appropriate selector in the print-media CSS file so
226222 that "noprint" elements don't get displayed.
227223
228- This is just an example of how the effect of the "No print" checkbox
229- can be ultimately implemented. It is meant to show that just adding
224+ This is just an example of how the "No print" checkbox
225+ can be implemented. It is meant to show that just adding
230226 the field to the :php: `$GLOBALS['TCA'] ` is not enough.
0 commit comments