Class AdminPageFramework_FieldType_media
A text field with a media uploader lets the user set a file URL.
This class defines the media field type.
Field Definition Arguments
Field Type Specific Arguments
- 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, 'id',
'caption', and 'description'. 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.2.0+] (optional, boolean) there are
additional nested attribute arguments.
button
- (array) applies to the Select File button.remove_button
- (array) applies to the Remove button.
Common Field Definition Arguments
For common field definition arguments, seeAdminPageFramework_Factory_Controller::addSettingField()
.
Example
array(
'field_id' => 'media_with_attributes',
'title' => __( 'Media File with Attributes', 'admin-page-framework-loader' ),
'type' => 'media',
'attributes_to_store' => array( 'id', 'caption', 'description' ),
'attributes' => array(
'button' => array(
'data-label' => __( 'Select File', 'admin-page-framework-loader' ),
),
'remove_button' => array( // 3.2.0+
'data-label' => __( 'Remove', 'admin-page-framework-loader' ), // will set the Remove button label instead of the dashicon
),
),)
Since: 2.1.5
Extends: AdminPageFramework_FieldType_image
Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/media.png
Located at factory/_common/form/field_type/media/AdminPageFramework_FieldType_media.php
Methods summary
protected
array
|
#
getEnqueuingScripts( )
|
protected
string
|
#
_getPreviewContainer( array $aField, string $sImageURL, array $aPreviewAtrributes )
Override the parent method not to show the preview. Parameters
Returnsstring |
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.
|