Custom Fields

This are all custom fields supported by Camaleon CMS:


    items[:text_box] = {
        key: 'text_box',
        label: t('camaleon_cms.admin.custom_field.fields.text_box'),
        options: {
            required: true,
            multiple: true,
            translate: true,
            default_value: true,
            show_frontend: true
        }
    }

    items[:text_area] = {
        key: 'text_area',
        label: t('camaleon_cms.admin.custom_field.fields.text_area'),
        options: {
            required: true,
            multiple: true,
            translate: true,
            default_value: true,
            show_frontend: true
        }
    }
    items[:select] = {
        key: 'select',
        label: t('camaleon_cms.admin.custom_field.fields.select'),
        options: {
            required: true,
            multiple: false,
            multiple_options: {
                label: t('camaleon_cms.admin.settings.options_select'),
                default: 'radio'
            },
            show_frontend: true
        }
    }
    items[:radio] = {
        key: 'radio',
        label: 'Radio',
        options: {
            required: true,
            multiple: false,
            multiple_options: {
                label: t('camaleon_cms.admin.settings.options_select'),
                default: 'radio',
                use_not_default: true
            },
            show_frontend: true
        }
    }

    items[:checkbox] = {
        key: 'checkbox',
        label: 'Checkbox',
        options: {
            required: true,
            multiple: false,
            default_value: true,
            show_frontend: true
        }
    }

    items[:checkboxes] = {
        key: 'checkboxes',
        label: 'Checkboxes',
        options: {
            required: false,
            multiple: false,
            multiple_options: {
                label: 'Checkboxes',
                default: 'checkbox'
            },
            show_frontend: true
        }
    }

    items[:audio] = {
        key: 'audio',
        label: 'Audio',
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }



    items[:colorpicker] = {
        key: 'colorpicker',
        label: t('camaleon_cms.admin.custom_field.fields.colorpicker'),
        extra_fields:[
            {
                type: 'select',
                key: 'color_format',
                label: 'Color Format',
                values: [
                    {
                        value: 'hex',
                        label: 'hex'
                    },
                    {
                        value: 'rgb',
                        label: 'rgb'
                    },
                    {
                        value: 'rgba',
                        label: 'rgba'
                    }
                ]
            }
        ],
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }

    items[:date] = {
        key: 'date',
        label: t('camaleon_cms.admin.custom_field.fields.date'),
        extra_fields:[
            {
                type: 'radio',
                key: 'type_date',
                values: [
                    {
                        value: '0',
                        label: t('camaleon_cms.admin.settings.input_only_date')
                    },
                    {
                        value: '1',
                        label: t('camaleon_cms.admin.settings.input_date_time')
                    }
                ]
            }
        ],
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }

    items[:editor] = {
        key: 'editor',
        label: 'Editor',
        options: {
            required: false,
            multiple: true,
            translate: true,
            default_value: true,
            show_frontend: true
        }
    }

    items[:email] = {
        key: 'email',
        label: t('camaleon_cms.admin.custom_field.fields.email'),
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }

    items[:file] = {
        key: 'file',
        label: t('camaleon_cms.admin.custom_field.fields.file'),
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true,
        },
        extra_fields:[
            {
                type: 'text_box',
                key: 'formats',
                label: 'File Formats (image,video,audio)'
            }
        ]
    }

    items[:image] = {
        key: 'image',
        label: t('camaleon_cms.admin.custom_field.fields.image'),
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }

    items[:numeric] = {
        key: 'numeric',
        label: t('camaleon_cms.admin.custom_field.fields.numeric'),
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }

    items[:phone] = {
        key: 'phone',
        label: t('camaleon_cms.admin.custom_field.fields.phone'),
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }


    items[:url] = {
        key: 'url',
        label: 'URL',
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }
    items[:video] = {
        key: 'video',
        label: 'Video',
        options: {
            required: true,
            multiple: true,
            default_value: true,
            show_frontend: true
        }
    }

    items[:users] = {
        key: 'users',
        label: t('camaleon_cms.admin.custom_field.fields.users'),
        options: {
            required: true,
            multiple: true,
            show_frontend: true
        }
    }

    items[:posts] = {
        key: 'posts',
        label: t('camaleon_cms.admin.custom_field.fields.posts'),
        options: {
            required: true,
            multiple: true,
            show_frontend: true
        },
        extra_fields:[
            {
                type: 'checkbox',
                key: 'post_types',
                label: 'Post types',
                values: current_site.post_types.pluck(:id, :name).map{|pt| {value: pt.first, label: pt.last}}.unshift({value: "all", label: "--- All Post Types ---"})
            }
        ]
    }

    # evaluate the content of command value on listing
    # sample: get_select_options({})
    items[:select_eval] = {
        key: 'select_eval',
        label: t('camaleon_cms.admin.custom_field.fields.select_eval'),
        options: {
            required: true,
            multiple: false,
            default_value: false,
            show_frontend: false
        },
        extra_fields:[
            {
                type: 'text_area',
                key: 'command',
                label: 'Command to Eval'
            }
        ]
    }

    items[:field_attrs] = {
        key: 'field_attrs',
        label: t('camaleon_cms.admin.custom_field.fields.field_attrs'),
        options: {
            required: false,
            multiple: true,
            show_frontend: true
        }
    }
                    

Created at: 26 Nov 19:49 | Updated at: 15 Jun 15:58