Add field to pages

To add the coordinates element to the Resources Tab of a page for example, you have to add this to the pages.php:

1. Create a new column

To display the coordinates element you have to create a new column of your pages.php. Your pages.php could look like this, for example:

$GLOBALS['TCA']['pages']['columns']['tx_csimagepoint_coordinates'] = [
    'label' => 'LLL:EXT:cs_image_point/Resources/Private/Language/locallang.xlf:tx_csimagepoint_coordinates.label',
    'description' => 'LLL:EXT:cs_image_point/Resources/Private/Language/locallang.xlf:tx_csimagepoint_coordinates.description',
    'config' => [
        'type' => 'user',
        'renderType' => 'imagePointField',
        'parameters' => [
            'imageFieldName' => 'image',
            'isImageInParentRecord' => false,
        ],
    ],
];

Important: Make sure you have previously added the new table under Admin Tools > Maintenance.

Parameters

  • imageFieldName: Specify the name of the element from which the image is taken
  • isImageInParentRecord: True if the current element is an inline record and the image field is placed by parent, e.g. multiple tooltips.

2. Add the new column to your types

To display the coordinates element you have to add it to the types of your pages.php. Your pages.php could look like this, for example:

ExtensionManagementUtility::addToAllTCAtypes(
    'pages',
    'tx_csimagepoint_coordinates',
    '',
    'after:media'
);

3. Flush all caches

The last step: Clear the cache so that the TCA change takes effect.