Class AdminPageFramework_FieldType_image
A text field with an image uploader.
This class defines the image field type.
Field Definition Arguments
Field Type Specific Arguments
- show_preview - (optional, boolean) if this is set to false, the image preview will be disabled.
- attributes_to_store - [2.1.3+] (optional, array) the array
of the attribute names of the image to save. If this is set, the field will be
an array with the specified attributes. The supported attributes are, 'title',
'alt', 'width', 'height', 'caption', 'id', 'align', and 'link'. Note that for
external URLs, ID will not be captured. e.g.
'attributes_to_store' => array( 'id', 'caption', 'description' )
- allow_external_source - [2.1.3+] (optional, boolean) whether external URL can be set via the uploader.
- attributes - [3.0.0+] (optional, array) there are
additional nested arguments.
input
- (array) applies to the input tag element.preview
- (array) applies to the preview container element.button
- (array) applies to the image select (uploader) button. To set a custom text label instead on of an image icon, set it to thedata-label
attribute. e.g.'button' => array( 'data-label' => 'Select Image' )
remove_button
- (array) [3.2.0+] applies to the remove-image button. To set a custom text label instead on of an image icon, set it to thedata-label
attribute. e.g.'remove_button' => array( 'data-label' => 'Remove Image' )
Common Field Definition Arguments
For common field definition arguments, seeAdminPageFramework_Factory_Controller::addSettingField()
.
Example
array( 'field_id' => 'image_select_field', 'title' => __( 'Select an Image', 'admin-page-framework-loader' ), 'type' => 'image', 'label' => __( 'First', 'admin-page-framework-loader' ), 'default' => plugins_url( 'asset/image/demo/wordpress-logo-2x.png', AdminPageFrameworkLoader_Registry::$sFilePath ), 'allow_external_source' => false, 'attributes' => array( 'preview' => array( 'style' => 'max-width:300px;' // the size of the preview image. ), ) )
Package: AdminPageFramework\Common\Form\FieldType
Since: 2.1.5
Since: 3.5.3 Changed it to extend
Extends: AdminPageFramework_FieldType
Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/image.png
Located at factory/_common/form/field_type/image/AdminPageFramework_FieldType_image.php
Since: 2.1.5
Since: 3.5.3 Changed it to extend
AdminPageFramework_FieldType
from
AdminPageFramework_FieldType_Base
.Extends: AdminPageFramework_FieldType
Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/image.png
Located at factory/_common/form/field_type/image/AdminPageFramework_FieldType_image.php
Methods summary
protected
array
|
#
getEnqueuingScripts( )
|
protected
string
|
#
_getUploaderButtonHTML( mixed $sInputID, array $aButtonAttributes, mixed $bRepeatable, mixed $bExternalSource )
Returns an HTML output of an uploader button. Returnsstring The generated HTML uploader button output. Since
3.5.3
3.9.0 Changed the visibility scope to protected from private to be overridden by extended classes. |
protected
array
|
#
_getFormattedUploadButtonAttributes( mixed $sInputID, array $aButtonAttributes, mixed $_bIsLabelSet, mixed $bRepeatable, mixed $bExternalSource )
Returns a formatted upload button attributes array. Returnsarray The formatted upload button attributes array. Since
3.5.3
3.9.0 Changed the visibility scope to protected from private to be overridden by extended classes. |
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.
|