JoeSz / Exopite-Simple-Options-Framework

Fast, easy and lightweight admin options/metabox form generator for WordPress Plugins and metaboxes.
GNU General Public License v3.0
78 stars 24 forks source link

Refactoring main class to include some helper functions #6

Closed raoabid closed 6 years ago

raoabid commented 6 years ago

helper functions included. added PHPDocs block to explain what it does. Now if a user adds a config array that is missing some 'required' keys, they will get admin notice, I shall restrict the admin notice to only our relevant admin pages.

The required fields are defined in:

        /*
         * @var array required fields for all $type
         */
        protected $required_keys_all_types = array( 'type' );

        /*
         * @var array required fields for $type = menu
         */
        protected $required_keys_menu = array( 'id', 'menu' );

        /*
         * @var array required fields for $type = metabox
         */
        protected $required_keys_metabox = array( 'id', 'post_types', 'title', 'capability' );

We may change these, but i have added that are required as per my experience.

Further, do you have any help doc that explains which scripts loaded are required by which fields? That way, we can load scripts on per-field basis instead of per-type basis.