Advanced Configuration (deprecated)

Starting with version 1.7 this is not the recommended method of defining settings for fields. It is now recommended to use the YAML settings when managing a Simple Grid field in the control panel.

If you had settings added to your config file with this method they will continue to work, but support is no longer provided if you encounter an issue.

Simple Grids & Tables was designd to be simple, hence the name, however there have been many requests to add more configuration options to the columns in a Simple Grid field. Instead of a large refactor, and complicating the UI of a Simple Grid field configuration screen, you can now manage the configuration options of each column by adding an array to your site's config.php file. You can define global options that apply to every column type, or define the options of a specific column in a field. Since this is an advanced configuration you will need to inspect the HTML and find the IDs, or take note of the IDs in the URL when editing the fields.

Support is not provided to help find the IDs of your fields and columns, but here are some examples of how to find them:

Example Config

$config['simple_grid'] = [
    // Examples of global overrides for each field type with their default values and possible options.
    // These settings will be applied to every instance of the field type, regardless of where it appears.
    // You can define field specific options (examples below), then default all remaining instances of
    // a column type to the global settings if defined.
    'file' => [
        'allowed_directories' => '', // [int] (ID of upload directory)
        'field_content_type' => 'all', // image
        'num_existing' => 0, // [int]
        'show_existing' => 'y', // y, n
    ],
    'text' => [
        'field_content_type' => 'all', // numeric, integer, or decimal
        'field_show_file_selector' => 'n', // y
        'field_text_direction' => 'ltr', // rtl
        'field_maxl' => 256, // [int]
        'field_show_fmt' => 'n', // y
        'field_fmt' => 'n' // y
    ],
    'url' => [
        'url_scheme_placeholder' => 'https://',
        'allowed_url_schemes' => [
            'http://'  => 'http://',
            'https://' => 'https://',
            '//'      => '// (Protocol Relative URL)',
            'ftp://'  => 'ftp://',
            'mailto:' => 'mailto:',
            'sftp://' => 'sftp://',
            'ssh://'  => 'ssh://',
        ]
    ],

    // Examples of overriding the settings on a per-field/column basis

    // Standalone Simple Grid fields
    'field_id_9' => [ // field_id
        'col_id_2' => [ // Simple Grid col_id
            'allowed_directories' => 5
        ],
    ],
    'field_id_21' => [
        'col_id_3' => [
            'allowed_directories' => 6
        ],
    ],
    // When Simple Grid field is inside of a Bloqs field. Note we don't care about the Bloqs' field_id
    'col_id_9' => [ // Bloq atom_id, not the Bloq field_id
        'col_id_1' => [ // Simple Grid col_id
            'field_maxl' => 3,
        ],
        'col_id_3' => [ // Simple Grid col_id
            'allowed_directories' => 6,
        ]
    ],
];

Supported Config Options

Below is a list of fieldtypes and the override options along with their default values that are supported by Simple Grid. Other available options values are noted next to the option after the // code comment.

Date and DateTime Fields

No config override options available

File Field

'allowed_directories' => '', // [int] (ID of upload directory)
'field_content_type' => 'all', // 'image'
'num_existing' => 0, // [int]
'show_existing' => 'y', // or 'n'

Textarea

'field_ta_rows' => '6', // [int]
'field_show_formatting_btns' => 'n', // or 'y'
'field_text_direction' => 'ltr', // or 'rtl' 

RTE Field (EE7+ only)

'defer' => false,
'toolset_id' => null, // Will use the default toolset if not defined

Text

'field_content_type' => 'all', // numeric, integer, or decimal
'field_show_file_selector' => 'n', // or 'y'
'field_text_direction' => 'ltr', // or 'rtl'
'field_maxl' => 256, // [int]
'field_show_fmt' => 'n', // or 'y'
'field_fmt' => 'n' // or 'y'

Toggle

'field_default_value' => '0', // or '1'

URL

'url_scheme_placeholder' => 'https://',
'allowed_url_schemes' => [
    'http://'  => 'http://',
    'https://' => 'https://',
    '//'      => '// (Protocol Relative URL)',
    'ftp://'  => 'ftp://',
    'mailto:' => 'mailto:',
    'sftp://' => 'sftp://',
    'ssh://'  => 'ssh://',
]

Last updated