KurtJensen
KurtJensen

I would like to be able to use a mix of PHP and YAML for defining fields. This may solve some form problems where options or values need to change on a AJAX refresh where one field depends on another. Also might solve issues such as https://octobercms.com/forum/post/need-some-help-with-dropdowns-extending-the-user-plugin

For example, I would like to be able to do the following:

config_relation.yaml

# ===================================
#  Relation Behavior Config
# ===================================

comments:
    label: Comment
    list: @/plugins/october/test/models/comment/columns.yaml
    form: @/plugins/october/test/models/comment/fields.php

fields.php

<?php
//# ===================================
//#  Form Field Definitions
//# ===================================

return array('fields' =>[

    //# Hide this field for context 'relation'
    'post'=>[
        'type' => 'relation',
        'nameFrom' => 'name',
        'emptyOption' => '-- Select Post --',
        'comment' => 'This Comment belongs to the Post selected above.',
        'context' => ['create', 'update'],
        ]
    'name'=>[
        'label: Name',
        'commentAbove: Text field, inside a popup.',
        ],
    ],

'tabs' =>[

    'fields'=>[

        'photo'=>[
            'span' => 'auto',
            'label' => 'Photo',
            'type' => 'fileupload',
            'commentAbove' = 'Image upload inside a tab, inside a popup.',
            'mode' => 'image',
            'imageHeight' => '150',
            'imageWidth' => '150',
            'tab' => 'File Upload',
            ],

        'content'=>[
            'label' => 'Content',
            'type' => 'richeditor',
            'tab' => 'Rich Editor',
            'commentAbove' => 'Content inside a tab, inside a popup.',
            ],
        ]
    ]
);

The PHP could contain code to effect fields based on POST variables or other influences.

Last updated

1-1 of 1