TYPO3: Allow records on the root page

Writing a TYPO3 extension, I needed to allow records of a certain table to be created on TYPO3's root page (pid=0). While the solution is easy, it took me a while to find it.

In ext_tables.php, add a rootLevel setting to your table's ctrl array:

$TCA['static_countries'] = array(
    'ctrl' => array(
        'title'     => 'Countries',
        'label'     => 'cn_short_en',
        'rootLevel' => 1,
    ...

TYPO3 allows three settings here: 0, 1 and -1, which are described in the Core API documentation:

rootLevel = 0
Records may only exist in the page tree, not in the root.
rootLevel = 1
Records may only exist in the root, not on the page tree. Note that only admins may edit records in the root page.
rootLevel = -1
Records may exist in both the root and the page tree.

Written by Christian Weiske.

Comments? Please send an e-mail. Or Reply or Like.