Configuration

Once installed, Fluidity's configuration is entirely managed in a PHP array.

Create a file called config.fluidity.php in your system/user/config folder. It will need to adhere to the following format:

<?php

return [
    // This is where your license key will go
    'licenseKey' => '',

    // Would you like Fluidity to check to see if there are updates?
    'checkForUpdates' => true,

    // By default it will show the field's icon.
    // This is a global setting which can be disabled on a
    // per-field basis in the advanced config.
    'showIcons' => true,
    
    // This is where you organize your fields into groups.
    'fields' => [
    
        // You will need the field ID, which you can find when
        // viewing the admin.php?/cp/fields page.
        1 => [
        
            // Give the group a friendly label
            'Group Label' => [
            
                // and finally all the fields you want to display in this group.
                'field_short_name',
                'another_field,
            ],
        ],
    ],
];
        

The following is an example of the advanced configuration. You can override the field's label, add a description, override it's default icon, or even choose which image to display in the preview pop-up.

<?php

return [
    'licenseKey' => '',
    'checkForUpdates' => true,
    'showIcons' => true,
    'fields' => [
        27 => [ // Fluid field ID
            'Add Content' => [
                'basic_text_field' => [
                    'label' => 'Basic Text Field',
                    'desc' => 'This is an optional extended description of the field. With even more text that wraps to another line.',
                    'icon' => 'https://www.publicdomainpictures.net/pictures/370000/velka/smiley-emoji.png',
                    'preview' => 'https://mysite.com/uploads/fluidity-demo-1.png',
                ],
                'text_field_group' => [
                    'label' => 'Special',
                    'desc' => 'Something Special',
                    'icon' => '', // to optionally disable a single icon, set the value to a blank string.
                    'preview' => 'https://mysite.com/uploads/fluidity-demo-2.png',
                ],
            ],
            'Add Misc' => [
                'template_or_snippet' => [
                    'label' => 'Embed Template or Snippet',
                ],
                'buttons' => [
                    'label' => 'Buttons',
                ],
                'color_picker' => [
                    'label' => 'Color Picker',
                ],
                'file' => [
                    'label' => 'File',
                ],
                'feature_flag' => [
                    'label' => 'Feature Flag',
                ],
            ],
        ],
    ]
];

You can optionally go with a basic config if you simply want to group fields and not override the field name, add a description, icon, or preview image.

<?php

return [
    'licenseKey' => '',
    'checkForUpdates' => true,
    'showIcons' => false,
    'fields' => [
        27 => [ // Fluid field ID
            'Content' => [
                'basic_text_field',
                'text_field_group',
            ],
            'Misc' => [
                'template_or_snippet',
                'buttons',
                'color_picker',
                'file',
                'feature_flag',
            ],
        ],
    ],
];

Since this is a PHP array, you can dynamically configure your field:

<?php

$contentFields = [
    'basic_text_field',
    'text_field_group',
];

$miscFields = [
    'template_or_snippet',
    'buttons',
    'color_picker',
    'file',
    'feature_flag',
];

return [
    'licenseKey' => '',
    'checkForUpdates' => true,
    'showIcons' => false,
    'fields' => [
        27 => [
            'Content' => $contentFields,
            'Misc' => $miscFields,
        ],
        28 => [
            'Content' => array_merge($contentFields, $miscFields),
        ]
    ],
];

Last updated