Page Tree

This widget allows you to select one or more pages from the site structure.

Page Tree widget Page Tree widget

Options

KeyValueDescription
inputTypepageTree (string)
eval.multipleboolIf true allows you to select several pages.
eval.fieldTypestringMandatory. Either 'checkbox' or 'radio' (for multiple).
eval.isSortablestringAllows you to sort the selected pages after making the selection (for multiple).

Examples

A single page picker.

// …
'jumpTo' => [
    'exclude' => true,
    'inputType' => 'pageTree',
    'foreignKey' => 'tl_page.title',
    'eval' => [
        'fieldType'  => 'radio',
    ],
    'sql' => [
        'type' => 'integer',
        'unsigned' => true,
        'default' => 0,
    ],
    'relation' => [
        'type' => 'hasOne', 
        'load' => 'lazy',
    ],
],
// …

Allows you to select multiple pages and sort them afterwards.

use Doctrine\DBAL\Platforms\MySQLPlatform;

// …
'pages' => [
    'exclude' => true,
    'inputType' => 'pageTree',
    'foreignKey' => 'tl_page.title',
    'eval' => [
        'mulitple' => true,
        'fieldType' => 'checkbox',
        'isSortable' => true,
    ],
    'sql' => [
        'type' => 'blob',
        'length' => MySQLPlatform::LENGTH_LIMIT_BLOB,
        'notnull' => false,
    ],
    'relation' => [
        'type' => 'hasMany', 
        'load' => 'lazy',
    ],
],
// …

Usage in Contao

The page tree widget is used very often in Contao. A few examples:

  • Within the navigation module it is used to set the optional reference page.
  • Within the search module it is used to set one ore more references pages to search through.
  • Within the settings of a news archive or calendar it is used to define the detail page of news and event records.