Location: PHPKode > scripts > Meta Builder > demo.php
<?php

$aMeta['company.form.add'] = array(
    'identity' => 'company-add-form',
    'groups' => array(
        array(
            'heading'       => 'Create New Company',
            'subheading'    => 'Use this tool to create a new company entry.',
            'rows'          => array(
                array(
                    'label'     => 'Name',
                    'element'   => array(
                        array(
                            'name'  => 'name',
                            'type'  => 'text',
                            'value' => 'Prepopulated Field',
                            'size'  => 30,
                            'validation'    => array(
                                'required'      => true,
                                'length'        => array(
                                    'min'   => 2,
                                    'max'   => 255
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'         => 'Registration No',
                    'image'         => '16x16/report.png',
                    'element'       => array(
                        array(
                            'name'  => 'registration_no',
                            'description'   => '<br/>Your allocated company registration number',
                            'size'   => 20,
                            'type'  => 'text',
                            'validation'    => array(
                                'length'        => array(
                                    'min'   => 10,
                                    'max'   => 32
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'         => 'Tax Registration No',
                    'image'         => '16x16/money-coin.png',
                    'element'       => array(
                        array(
                            'name'          => 'tax_registration_no',
                            'description'   => '<br/>Your tax registration number (if applicable)',
                            'type'          => 'text',
                            'size'          => 20,
                            'validation'    => array(
                                'length'        => array(
                                    'min'   => 6,
                                    'max'   => 255
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'         => 'Image/Logo',
                    'image'         => '16x16/image.png',
                    'element'       => array(
                        array(
                            'name'          => 'registered_as',
                            'size'          => 30,
                            'description'   => '<br/>Upload an image or logo you would like displayed.',
                            'type'          => 'file',
                        ),
                    )
                ),
                array(
                    'label'         => 'Category',
                    'image'         => '16x16/block.png',
                    'element'       => array(
                        array(
                            'name'          => 'category_id',
                            'type'          => 'list',
                            'description'   => '<br/>Select the category that best matches your company.',
                            'render-mode'   => 'select',
                            'list'          => array(
                                array(
                                    'value' => 'Service',
                                    'name' => 'Service',
                                ),
                                array(
                                    'value' => 'Manufacturers',
                                    'name' => 'Manufacturers',
                                ),
                                array(
                                    'value' => 'Retail',
                                    'name' => 'Retail',
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'         => 'Website',
                    'image'         => '16x16/application-browser.png',
                    'element'       => array(
                        array(
                            'name'          => 'website',
                            'description'   => '<br/>The companies website address (if applicable)',
                            'type'          => 'text',
                            'size'          => 30,
                            'validation'    => array(
                                'match'         => 'url',
                                'length'        => array(
                                    'min'   => 6,
                                    'max'   => 255
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'         => 'Description',
                    'element'       => array(
                        array(
                            'name'          => 'description',
                            'type'          => 'textarea',
                            'cols'          => 37,
                            'rows'          => 10,
                            'description'   => '<br/>Provide a long, indepth description for this company.',
                        ),
                    )
                ),
                array(
                    'element'   => array(
                        array(
                            'name'          => 'action',
                            'type'          => 'submit',
                            'value'         => 'Add Company'
                        )
                    )
                )
            )
        )
    )
);

$aMeta['company.grid'] = array(
    'identity'  => 'company-grid',
    'header'    => 'Companies',
    'columns'   => array(
        array(
            'name'      => 'id',
            'label'     => '',
            'type'      => 'checkbox',
        ),
        array(
            'name'      => 'id',
            'label'     => 'Id',
            'sort'      => 'numeric',
        ),
        array(
            'name'      => 'name',
            'label'     => 'Name',
            'sort'      => 'alpha',
            'link'      => array(
                'path'      => BuildUrl('company.php'),
                'param'     => array(
                    array(
                        'name'  => 'id',
                        'key'   => 'id'
                    )
                )
            )
        ),
        array(
            'name'      => 'category',
            'label'     => 'Category',
            'sort'      => 'alpha'
        ),
        array(
            'name'      => 'description',
            'label'     => 'Description',
            'format'    => 'truncate|40,...'
        ),
    ),
    'paging' => array(
        'num-records'   => 5
    ),
    'action' => array(
        'footer' => array(
            array(
                'class' => 'add',
                'name'  => 'Add New Company',
            ),
            array(
                'class' => 'delete',
                'name'  => 'Delete Company',
            )
        )
    )
);

$aMeta['auth.personal.update'] = array(
    'identity'  => 'personal-update-form',
    'script'    => 'post_to_this_page.php',
    'groups' => array(
        array(
            'heading'       => 'Update Account Details',
            'subheading'    => 'Personal',
            'copy'          => 'Please check our <a href="">Privacy Policy</a> if you have any concerns about your privacy.',
            'rows'          => array(
                array(
                    'label'     => 'Title',
                    'element'   => array(
                        array(
                            'name'          => 'title',
                            'type'          => 'list',
                            'render-mode'   => 'select',
                            'list'          => array(
                                array(
                                    'name'      => 'Mr.',
                                    'value'     => 'Mr.'
                                ),
                                array(
                                    'name'      => 'Mrs.',
                                    'value'     => 'Mrs.'
                                ),
                                array(
                                    'name'      => 'Ms.',
                                    'value'     => 'Ms.'
                                ),
                                array(
                                    'name'      => 'Mz.',
                                    'value'     => 'Mz.'
                                ),
                                array(
                                    'name'      => 'Dr.',
                                    'value'     => 'Dr.'
                                ),
                                array(
                                    'name'      => 'Prof.',
                                    'value'     => 'Prof.'
                                )
                            ),
                            'validation'    => array(
                                'length'        => array(
                                    'max'           => 10
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'     => 'First Name',
                    'element'   => array(
                        array(
                            'name'          => 'firstname',
                            'type'          => 'text',
                            'size'          => '30',
                            'validation'    => array(
                                'required'      => true,
                                'length'        => array(
                                    'max'           => 60,
                                    'min'           => 2
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'     => 'Last Name',
                    'element'   => array(
                        array(
                            'name'          => 'lastname',
                            'type'          => 'text',
                            'size'          => '30',
                            'validation'    => array(
                                'required'      => true,
                                'length'        => array(
                                    'max'           => 60,
                                    'min'           => 2
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'     => 'Gender',
                    'element'   => array(
                        array(
                            'name'          => 'gender',
                            'type'          => 'list',
                            'render-mode'   => 'radio',
                            'list'          => array(
                                array(
                                    'value'     => 1,
                                    'name'      => 'Male',
                                    'image'     => '16x16/gender-male.png'
                                ),
                                array(
                                    'value'     => 2,
                                    'name'      => 'Female',
                                    'image'     => '16x16/gender-female.png'
                                )
                            ),
                        )
                    )
                )
            )
        ),

        array(
            'subheading'    => 'Contact',
            'rows'          => array(
                array(
                    'label'     => 'Email Address',
                    'image'     => '16x16/mail.png',
                    'element'   => array(
                        array(
                            'name'          => 'email',
                            'type'          => 'text',
                            'size'          => 40,
                            'validation'    => array(
                                'match'         => 'email',
                                'required'      => true,
                                'length'        => array(
                                    'max'           => 255,
                                    'min'           => 8
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'     => 'Work Phone',
                    'element'   => array(
                        array(
                            'name'          => 'workphone',
                            'type'          => 'text',
                            'size'          => 16,
                            'validation'    => array(
                                'match'         => 'telephone',
                                'length'        => array(
                                    'max'           => 16,
                                    'min'           => 7
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'     => 'Mobile Phone',
                    'image'     => '16x16/mobile-phone.png',
                    'element'   => array(
                        array(
                            'name'          => 'mobilephone',
                            'type'          => 'text',
                            'size'          => 16,
                            'validation'    => array(
                                'match'         => 'telephone',
                                'required'      => true,
                                'length'        => array(
                                    'max'           => 16,
                                    'min'           => 7
                                )
                            )
                        )
                    )
                ),
                array(
                    'label'     => 'I want to receive',
                    'element'   => array(
                        array(
                            'name'          => 'communication_mask',
                            'type'          => 'list',
                            'render-mode'   => 'checkbox',
                            'list'          => array(
                                array(
                                    'value'     => 1,
                                    'name'      => 'Monthly Newsletters',
                                    'image'     => '16x16/mail.png'
                                ),
                                array(
                                    'value'     => 2,
                                    'name'      => 'System Alerts',
                                    'image'     => '16x16/mail.png'
                                )
                            ),
                        )
                    )
                )
            )
        ),
        array(
            'subheading'    => 'Location',
            'rows'          => array(
                array(
                    'label'     => 'Address',
                    'image'     => '16x16/home.png',
                    'element'   => array(
                        array(
                            'name'          => 'address1',
                            'type'          => 'text',
                            'size'          => 40,
                            'validation'    => array(
                                'required'      => true,
                                'length'        => array(
                                    'max'           => 255
                                )
                            )
                        ),
                    )
                ),
                array(
                    'element'   => array(
                        array(
                            'name'          => 'address2',
                            'type'          => 'text',
                            'description'   => '<br/>Your address is used by the search engine to match results close to your location.',
                            'size'          => 40,
                            'validation'    => array(
                                'length'        => array(
                                    'max'           => 255
                                )
                            )
                        ),
                    )
                ),
                array(
                    'label'         => 'Postal Code',
                    'element'       => array(
                        array(
                            'name'          => 'postalcode',
                            'type'          => 'text',
                            'image'         => '16x16/question.png',
                            'size'          => 4,
                            'validation'    => array(
                                'match'         => 'ajax',
                                'type'          => 'postal_code',
                                'required'      => true,
                                'length'        => array(
                                    'min'       => 5,
                                    'max'       => 5
                                )
                            )
                        ),
                    )
                ),
                array(
                    'id'            => 'city',
                    'label'         => 'City',
                    'element'       => array(
                        array(
                            'name'          => 'city',
                            'type'          => 'list',
                            'render-mode'   => 'select',
                            'list'          => array(
                                 array(
                                    'name'      => ' - Select City - ',
                                    'value'     => 0
                                ),
                            ),
                            'script'        => 'scripts/city.php',
                            'validation'    => array(
                                'required'      => true,
                            )
                        ),
                    )
                ),
                array(
                    'element'   => array(
                        array(
                            'name'  => 'action',
                            'type'  => 'submit',
                            'value' => 'Update Personal Details'
                        )
                    )
                )
            )
        )
    )
);

$aCompanies = array(
    array(
        'id'            => 1,
        'name'          => 'Company A',
        'category'      => 'Service',
        'description'   => 'Company A provides a service'
    ),
    array(
        'id'            => 2,
        'name'          => 'Company B',
        'category'      => 'Manufactorer',
        'description'   => 'Company B makes plastic cup holders'
    ),
    array(
        'id'            => 3,
        'name'          => 'Company C',
        'category'      => 'Retail',
        'description'   => 'Company C sells the items that Company B makes'
    ),
    array(
        'id'            => 4,
        'name'          => 'Company D',
        'category'      => 'Service',
        'description'   => 'Company D provides a service'
    ),
    array(
        'id'            => 5,
        'name'          => 'Company E',
        'category'      => 'Manufactorer',
        'description'   => 'Company E makes plastic cup holders'
    ),
    array(
        'id'            => 6,
        'name'          => 'Company F',
        'category'      => 'Retail',
        'description'   => 'Company F sells the items that Company E makes'
    ),
    array(
        'id'            => 7,
        'name'          => 'Company G',
        'category'      => 'Service',
        'description'   => 'Company G provides a service'
    ),
    array(
        'id'            => 8,
        'name'          => 'Company H',
        'category'      => 'Manufactorer',
        'description'   => 'Company H makes plastic cup holders'
    ),
    array(
        'id'            => 9,
        'name'          => 'Company I',
        'category'      => 'Retail',
        'description'   => 'Company I sells the items that Company H makes'
    ),
    array(
        'id'            => 10,
        'name'          => 'Company J',
        'category'      => 'Service',
        'description'   => 'Company J provides a service'
    ),
    array(
        'id'            => 11,
        'name'          => 'Company K',
        'category'      => 'Manufactorer',
        'description'   => 'Company K makes plastic cup holders'
    ),
    array(
        'id'            => 12,
        'name'          => 'Company L',
        'category'      => 'Retail',
        'description'   => 'Company L sells the items that Company K makes'
    ),
);
Return current item: Meta Builder