michaeluno / admin-page-framework

Facilitates WordPress plugin and theme development.
http://admin-page-framework.michaeluno.jp/
Other
340 stars 71 forks source link

How to create "non-settings" form field? #128

Closed fer-ri closed 10 years ago

fer-ri commented 10 years ago

Hi Michael,

In your demo/example you show us how to create form with load_ and $this->addSettingFields But how to create simple form thats not save any setting when submitted?

Thanks :)

michaeluno commented 10 years ago

There are two ways I can think of.

  1. Pass an empty string to the first parameter of the class constructor. This disables the ability of saving options of the framework class instance. See an example: https://gist.github.com/michaeluno/fcfac27825aa8a35b90f
  2. Set the name attribute argument to be empty in the field definition array.
array(
    'field_id'      => 'occurrence',
    'title'         => __( 'Occurrence', 'task-scheduler' ),
    'type'          => 'text',
    'attributes'    => array(
        'name' => '',    // <-- this one!
    ),
),

Hope it helps. Also don't forget to look over the FAQ and Other Notes sections as there are some relevant information!

fer-ri commented 10 years ago

Thanks a lot :)

michaeluno commented 10 years ago

Glad it helped!