PHP 클래스 Select2CustomFieldType

This class defines the select2 field type.

Field Definition Arguments

Field Type Specific Arguments

  • **is_multiple** - (optional, boolean) if this is set to true, the multiple attribute will be inserted into the field input tag, which enables the multiple selections for the user.
  • **options** - (optional, array) The options argument passed to the select2 method. For detaks, see https://select2.github.io/options.html
  • **callback** - (optional, array)
    • **search** - (optional, callable) Set a callback function that is triggered in the background when the user type something in the select input field expecting a list of suggested items will be displayed. - $aQueries - (array) an array holding the following arguments. - q - (string) the queried characters. - page - (string) the pagination number. When the result has too many items, it can be paginated. - field_id - (string) the field ID that calls the query. - section_id - (string) the section ID that calls the query. - $aFieldset - (array) the field definition array. The callback method is expected to return an array with the following structure: array( 'results' => array( array( 'id' => 224, //the value saved in the database. 'text' => 'The title of this item.' //The text displayed in the drop-down list. ), array( 'id' => 567, 'text' => 'The title of this item.' ), ... continues ... ), 'pagination' => array( // can be omitted 'more' => true, // (boolean) or false - whether the next paginated item exists or not. ) )
    • **new_tag** - (optional, callable) Set a callback function that is called when the user creates a new tag. - $aQueries - (array) an array holding the following arguments. - tag - (string) the tag name. - field_id - (string) the field ID that calls the query. - section_id - (string) the section ID that calls the query. - $aFieldset - (array) the field definition array. If this callback is set, the options -> tags argument will be automatically enabled. The callback method is expected to return an array with the following structure: array( 'id' => 78, // the value which will be stored in the database. 'text' => 'Tag Name', // the tag name gets displayed in the field. 'note' => 'A console message.' // (optional) A note displayed in the browser console. 'error' => 'An error massage.', // (optional) if this is set, an error message will be displayed. )
부터: 3.8.7
상속: extends AdminPageFramework_FieldType_select
파일 보기 프로젝트 열기: michaeluno/admin-page-framework

공개 프로퍼티들

프로퍼티 타입 설명
$aFieldTypeSlugs Defines the field type slugs used for this field type.

보호된 프로퍼티들

프로퍼티 타입 설명
$aDefaultKeys Defines the default key-values of this field type settings.

공개 메소드들

메소드 설명
getField ( $aField ) : string Returns the output of the field type.
setUp ( ) Loads the field type necessary components.

보호된 메소드들

메소드 설명
construct ( )
doOnFieldRegistration ( $aFieldset ) Callks back the callback function if it is set.
getEnqueuingScripts ( ) : array Returns an array holding the urls of enqueuing scripts.
getEnqueuingStyles ( ) : array
getScripts ( ) Returns the field type specific JavaScript script.
getStyles ( ) Returns the field type specific CSS rules.

비공개 메소드들

메소드 설명
_getAjaxCallback ( $aRequest, $aFieldset ) : boolean | callable
_getAttributesUpdatedForAJAX ( $aField ) : array For AJAX enabled fields, the stored field data structure becomes different.
_getCamelCaseToDashed ( $sString ) : string
_getChildInputByKey ( $sKey, $aField ) : string
_getSelect2OptionsFormatted ( $aOptions, $aField ) : array
_shouldProceedToAjaxRequest ( $aRequest, $aFieldset ) : boolean

메소드 상세

construct() 보호된 메소드

protected construct ( )

doOnFieldRegistration() 보호된 메소드

Called when the field type is registered.
protected doOnFieldRegistration ( $aFieldset )

getEnqueuingScripts() 보호된 메소드

Returns an array holding the urls of enqueuing scripts.
protected getEnqueuingScripts ( ) : array
리턴 array

getEnqueuingStyles() 보호된 메소드

protected getEnqueuingStyles ( ) : array
리턴 array

getField() 공개 메소드

Returns the output of the field type.
public getField ( $aField ) : string
리턴 string

getScripts() 보호된 메소드

Returns the field type specific JavaScript script.
protected getScripts ( )

getStyles() 보호된 메소드

Returns the field type specific CSS rules.
protected getStyles ( )

setUp() 공개 메소드

Loads the field type necessary components.
public setUp ( )

프로퍼티 상세

$aDefaultKeys 보호되어 있는 프로퍼티

Defines the default key-values of this field type settings.
protected $aDefaultKeys

$aFieldTypeSlugs 공개적으로 프로퍼티

Defines the field type slugs used for this field type.
public $aFieldTypeSlugs