Admin Page Framework Documentation

Packages

  • AdminPageFramework
    • Common
      • Factory
      • Form
        • FieldType
      • Utility
    • Factory
      • AdminPage
      • MetaBox
      • NetworkAdmin
      • PageMetaBox
      • PostType
      • TaxonomyField
      • TermMeta
      • UserMeta
      • Widget
    • Utility

Classes

  • AdminPageFramework_FieldType
  • AdminPageFramework_FieldType_checkbox
  • AdminPageFramework_FieldType_color
  • AdminPageFramework_FieldType_contact
  • AdminPageFramework_FieldType_export
  • AdminPageFramework_FieldType_file
  • AdminPageFramework_FieldType_hidden
  • AdminPageFramework_FieldType_image
  • AdminPageFramework_FieldType_import
  • AdminPageFramework_FieldType_inline_mixed
  • AdminPageFramework_FieldType_media
  • AdminPageFramework_FieldType_number
  • AdminPageFramework_FieldType_posttype
  • AdminPageFramework_FieldType_radio
  • AdminPageFramework_FieldType_section_title
  • AdminPageFramework_FieldType_select
  • AdminPageFramework_FieldType_size
  • AdminPageFramework_FieldType_submit
  • AdminPageFramework_FieldType_system
  • AdminPageFramework_FieldType_table
  • AdminPageFramework_FieldType_taxonomy
  • AdminPageFramework_FieldType_text
  • AdminPageFramework_FieldType_textarea

Resources

  • Tutorials
  • Support
  • Reporting Issues

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 the data-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 the data-label attribute. e.g. 'remove_button' => array( 'data-label' => 'Remove Image' )

Common Field Definition Arguments

For common field definition arguments, see AdminPageFramework_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 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( )

Returns

array

Since

3.9.0

Overrides

AdminPageFramework_FieldType::getEnqueuingScripts
protected string
# _getUploaderButtonHTML( mixed $sInputID, array $aButtonAttributes, mixed $bRepeatable, mixed $bExternalSource )

Returns an HTML output of an uploader button.

Returns

string
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.

Returns

array
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.

Related

Direct known subclasses

AdminPageFramework_FieldType_media

If you find undocumented functionality, please report it here.

Admin Page Framework