Class AdminPageFramework_FieldType_submit
Defines the submit
field type.
Field Definition Arguments
Field Type Specific Arguments
- href - (optional, string) the url(s) linked to the submit button.
- redirect_url - (optional, string) the url(s) redirected to after submitting the input form.
- reset - [2.1.2+] (optional, boolean|string|array) the
option key to delete. Set 1 for the entire option. [3.5.3+] In order to reset a
particular field that belongs to a section, set an array representing the
dimensional keys such as
array( 'my_sectio_id', 'my_field_id' )
. - confirm - [3.8.24+] (optional, string|array) A confirmation
checkbox to be enabled. If non-empty value is set, it will appear. An empty
string by default. An array of the following arguments is accepted.
- label - (string) the checkbox label.
- error - (string) the error message to display when the user does not check it but presses the submit button.
- skip_confirmation - [3.7.6+] (optional, boolean) Whether to
skip confirmation. Default:
false
. - email - [3.9.0+] deprecated Use the
contact
field type. - save - [3.9.0+] (optional, boolean) Whether to save the
value of the button, which is usually the label text. Default:
false
.
Common Field Definition Arguments
For common field definition arguments, seeAdminPageFramework_Factory_Controller::addSettingField()
.
Example
array( 'field_id' => 'submit_button_field', 'title' => __( 'Submit Button', 'admin-page-framework-loader' ), 'type' => 'submit', 'save' => false, )
Submit Button as a Link
array( 'field_id' => 'submit_button_link', 'type' => 'submit', 'title' => __( 'Link Button', 'admin-page-framework-loader' ), 'label' => 'WordPress', 'href' => 'https://wordpress.org', 'attributes' => array( 'class' => 'button button-secondary', 'title' => __( 'Go to Google!', 'admin-page-framework-loader' ), 'style' => 'background-color: #C1DCFA;', 'field' => array( 'style' => 'display: inline; clear: none;', ), ), )
Download Button
array( 'field_id' => 'submit_button_download', 'title' => __( 'Download Button', 'admin-page-framework-loader' ), 'type' => 'submit', 'label' => __( 'Admin Page Framework', 'admin-page-framework-loader' ), 'href' => 'http://downloads.wordpress.org/plugin/admin-page-framework.latest-stable.zip', )
Redirect Button
Unlike thehref
argument, with the redirect
argument,
the form data will be saved and the user gets redirected.
array( 'field_id' => 'submit_button_redirect', 'title' => __( 'Redirect Button', 'admin-page-framework-loader' ), 'type' => 'submit', 'label' => __( 'Dashboard', 'admin-page-framework-loader' ), 'redirect_url' => admin_url(), 'attributes' => array( 'class' => 'button button-secondary', ), )
Submit Button with an Image
Instead of a text label, an image can be used for the button.array( 'field_id' => 'image_submit_button', 'title' => __( 'Image Submit Button', 'admin-page-framework-loader' ), 'type' => 'submit', 'href' => 'http://en.michaeluno.jp/donate', 'attributes' => array( 'src' => AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/image/donation.gif', 'alt' => __( 'Submit', 'admin-page-framework-loader' ), 'class' => '', ), )
Reset Button
With thereset
argument, the user can reset stored form data.
array( 'field_id' => 'submit_button_reset', 'title' => __( 'Reset Button', 'admin-page-framework-loader' ), 'type' => 'submit', 'label' => __( 'Reset', 'admin-page-framework-loader' ), 'reset' => true, 'attributes' => array( 'class' => 'button button-secondary', ), )
Package: AdminPageFramework\Common\Form\FieldType
Since: 2.1.5
Since: 3.3.1 Changed to extend
Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/submit.png
Located at factory/_common/form/field_type/submit/AdminPageFramework_FieldType_submit.php
Since: 2.1.5
Since: 3.3.1 Changed to extend
AdminPageFramework_FieldType
from
AdminPageFramework_FieldType_Base
.Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/submit.png
Located at factory/_common/form/field_type/submit/AdminPageFramework_FieldType_submit.php
Methods summary
protected
array
|
#
getEnqueuingScripts( )
|
Magic methods summary
Properties summary
public
array
|
$aFieldTypeSlugs |
#
Defines the field type slugs used for this field type. |
protected
array
|
$aDefaultKeys |
#
Defines the default key-values of this field type. Remark
$_aDefaultKeys holds shared default key-values defined in the base class.
|
Related
Direct known subclasses
AdminPageFramework_FieldType_contact
,
AdminPageFramework_FieldType_export
,
AdminPageFramework_FieldType_import