Admin Page Framework Documentation
  • Package
  • Class
  • Tree

Packages

  • AdminPageFramework
    • AdminPage
    • Factory
    • FieldType
    • MetaBox
    • NetworkAdmin
    • PageMetaBox
    • PostType
    • TaxonomyField
    • Widget

Classes

  • AdminPageFramework_FieldType

Class AdminPageFramework_FieldType

The base class for the users to create their custom field types.

When a framework user implements a custom field type into his/her work, this class may be extended to create a field definition class.

AdminPageFramework_Utility_String
Extended by AdminPageFramework_Utility_Array
Extended by AdminPageFramework_Utility_Path
Extended by AdminPageFramework_Utility_URL
Extended by AdminPageFramework_Utility
Extended by AdminPageFramework_WPUtility_URL
Extended by AdminPageFramework_WPUtility_HTML
Extended by AdminPageFramework_WPUtility_Page
Extended by AdminPageFramework_WPUtility_Hook
Extended by AdminPageFramework_WPUtility_File
Extended by AdminPageFramework_WPUtility_Option
Extended by AdminPageFramework_WPUtility_Post
Extended by AdminPageFramework_WPUtility
Extended by AdminPageFramework_FieldType_Base
Extended by AdminPageFramework_FieldType
Abstract
Package: AdminPageFramework\FieldType
Since: 2.1.5
Since: 3.0.0 Changed the name from AdminPageFramework_CustomFieldType to AdminPageFramework_FieldType.
Remark: The user will extend this class to define their custom field types.
Located at _view/AdminPageFramework_FieldType/AdminPageFramework_FieldType.php

Methods summary

protected
# construct( )

The user constructor.

When the user defines a field type, they may use this instead of the real constructor so that they don't have to care about the internal parameters.

Since

3.1.3

Remark

The user will override this method in their class definition.

Overrides

AdminPageFramework_FieldType_Base::construct
protected
# setUp( )

Loads the field type necessary components.

This method is triggered when a field definition array that calls this field type is parsed.

Since

3.0.0

Remark

The user will override this method in their class definition.
protected
# getScripts( )

Returns the JavaScript output inside the <script></script> tags.

Since

3.0.0

Remark

The user will override this method in their class definition.
protected
# getIEStyles( )

Returns the CSS output specific to Internet Explorer inside the <style></style> tags.

Since

3.0.0

Remark

The user will override this method in their class definition.
protected
# getStyles( )

Returns the field type specific CSS output inside the <style></style> tags.

Since

3.0.0

Remark

The user will override this method in their class definition.
protected
# getField( mixed $aField )

Returns the field output.

Since

3.0.0

Remark

The user will override this method in their class definition.
protected
# getEnqueuingScripts( )

Returns an array holding the urls of enqueuing scripts.

The returning array should consist of all numeric keys. Each element can be either a string( the url or the path of the source file) or an array of custom argument.

Custom Argument Array

  • src - (required, string) The url or path of the target source file
  • handle_id - (optional, string) The handle ID of the script.
  • dependencies - (optional, array) The dependency array. For more information, see codex.
  • version - (optional, string) The stylesheet version number.
  • translation - (optional, array) The translation array. The handle ID will be used for the object name.
  • in_footer - (optional, boolean) Whether to enqueue the script before </head> or before </body > Default: false.
  • attributes - (optional, array) [3.3.0+] attribute argument array. array( 'async' => '', 'data-id' => '...' )

Examples

protected function getEnqueuingScripts() {
     return array(
         array(     // if you need to set a dependency, pass as a custom argument array.
             'src' => dirname( __FILE__ ) . '/asset/my_script.js',     // path or url
             'dependencies' => array( 'jquery' )
         ),
         dirname( __FILE__ ) . '/asset/my_another.js', // a string value of the target path or url will work as well.
     );
}

Remark

The user will override this method in their class definition.
protected
# getEnqueuingStyles( )

Returns an array holding the urls of enqueuing styles.

The returning array should consist of all numeric keys. Each element can be either a string( the url or the path of the source file) or an array of custom argument.

Custom Argument Array

  • src - (required, string) The url or path of the target source file.
  • handle_id - (optional, string) The handle ID of the stylesheet.
  • dependencies - (optional, array) The dependency array. For more information, see codex.
  • version - (optional, string) The stylesheet version number.
  • media - (optional, string) the description of the field which is inserted into the after the input field tag.
  • attributes - (optional, array) [3.3.0+] attributes array. array( 'data-id' => '...' )

Examples

protected function getEnqueuingStyles() {
     return array(
         dirname( __FILE__ ) . '/asset/my_style.css',
         array(
             'src' => dirname( __FILE__ ) . '/asset/my_style2.css',
             'handle_id' => 'my_style2',
         ),
     );
}

Remark

The user will override this method in their class definition.

Methods inherited from AdminPageFramework_FieldType_Base

__construct(), _replyToFieldLoader(), _replyToFieldTypeSetter(), _replyToGetEnqueuingScripts(), _replyToGetEnqueuingStyles(), _replyToGetField(), _replyToGetInputIEStyles(), _replyToGetScripts(), _replyToGetStyles(), _replyToRegisterInputFieldType(), _replyToRemovingMediaLibraryTab(), _replyToReplaceThickBoxText(), enqueueMediaUploader(), geFieldOutput(), getDefinitionArray(), getFieldElementByKey()

Methods inherited from AdminPageFramework_WPUtility

FlushRewriteRules()

Methods inherited from AdminPageFramework_WPUtility_Post

getSavedMetaArray()

Methods inherited from AdminPageFramework_WPUtility_Option

deleteTransient(), getOption(), getSiteOption(), getTransient(), setTransient()

Methods inherited from AdminPageFramework_WPUtility_File

download(), getBaseNameOfURL(), getScriptData(), setTempPath()

Methods inherited from AdminPageFramework_WPUtility_Hook

addAndApplyFilter(), addAndApplyFilters(), addAndDoAction(), addAndDoActions(), doActions(), getFilterArrayByPrefix(), registerAction()

Methods inherited from AdminPageFramework_WPUtility_Page

getCurrentPostType(), getCurrentScreenID(), getPageNow(), isCustomTaxonomyPage(), isPostDefinitionPage(), isPostListingPage()

Methods inherited from AdminPageFramework_WPUtility_HTML

generateAttributes(), generateDataAttributes()

Methods inherited from AdminPageFramework_WPUtility_URL

getCurrentAdminURL(), getQueryAdminURL(), getQueryURL(), getSRCFromPath(), resolveSRC()

Methods inherited from AdminPageFramework_Utility

generateClassAttribute(), generateInlineCSS(), generateStyleAttribute(), getDataAttributeArray(), getQueryValueInURLByKey(), sanitizeLength()

Methods inherited from AdminPageFramework_Utility_URL

getCurrentURL()

Methods inherited from AdminPageFramework_Utility_Path

getCallerScriptPath(), getRelativePath()

Methods inherited from AdminPageFramework_Utility_Array

castArrayContents(), dropElementByValue(), dropElementsByType(), getArrayDimension(), getArrayValueByArrayKeys(), getAsArray(), getCorrespondingArrayValue(), getElement(), getElementAsArray(), getIntegerElements(), getNonIntegerElements(), getReadableArrayContents(), getReadableArrayContentsHTML(), getReadableListOfArray(), getReadableListOfArrayAsHTML(), invertCastArrayContents(), isAssociativeArray(), isFirstElement(), isLastElement(), numerizeElements(), shiftTillTrue(), uniteArrays(), uniteArraysRecursive()

Methods inherited from AdminPageFramework_Utility_String

fixNumber(), getStringLength(), minifyCSS(), sanitizeSlug(), sanitizeString()

Magic methods summary

Properties summary

public array $aFieldTypeSlugs
#

Defines the field type slugs used for this field type.

The slug is used for the type key in a field definition array.

$this->addSettingFields(
     array(
         'section_id'    => '...',
         'type'          => 'my_filed_type_slug', // <--- THIS PART
         'field_id'      => '...',
         'title'         => '...',
     )
);

Example

public $aFieldTypeSlugs = array( 'my_field_type_slug', 'alternative_field_type_slug' );
protected array $aDefaultKeys
#

Defines the default key-values of this field type.

The users will set the values to the defined keys and if not set, the value set in this property array will take effect. The merged array of the user's field definition array and this property array will be passed to the first parameter of the getField() method.

$this->addSettingFields(
    array(
        'section_id'         => '...', // built-in key
        'type'               => '...', // built-in key
        'field_id'           => '...', // built-in key
        'my_custom_key'      => 'the default value for this key', // <-- THIS PART
        'another_custom)key' => 'the default value for this key', // <-- THIS PART
    )
);

Example

$aDefaultKeys = array(
     'my_custom_key' => 'my default value',
     'attributes'    => array(
         'size'      => 30,
         'maxlength' => 400,
     ),
);

Remark

$_aDefaultKeys defined by the system internally holds shared default key-values defined in the base class.

Properties inherited from AdminPageFramework_FieldType_Base

$_aDefaultKeys, $_sFieldSetType, $oMsg

Admin Page Framework Documentation generated by ApiGen 2.8.0