PHP Class GitHubCustomFieldType

Inheritance: extends AdminPageFramework_FieldType
ファイルを表示 Open project: michaeluno/admin-page-framework Class Usage Examples

Public Properties

Property Type Description
$_bAddedScriptToFooter
$aFieldTypeSlugs The slug is used for the type key in a field definition array. $this->addSettingFields( array( 'section_id' => '...', 'type' => 'github', // <--- THIS PART 'field_id' => '...', 'title' => '...', ) );

Protected Properties

Property Type Description
$aDefaultKeys The keys are used for the field definition array. $this->addSettingFields( array( 'section_id' => '...', 'type' => '...', 'field_id' => '...', 'my_custom_key' => '...', // <-- THIS PART ) );

Public Methods

Method Description
_replyToAddScript ( )

Protected Methods

Method Description
construct ( ) User constructor.
getEnqueuingScripts ( ) Returns an array holding the urls of enqueuing scripts.
getEnqueuingStyles ( ) Returns an array holding the urls of enqueuing styles.
getField ( $aField ) Returns the output of the field type.
getIEStyles ( ) Returns IE specific CSS rules.
getScripts ( ) Returns the field type specific JavaScript script.
getStyles ( ) Returns the field type specific CSS rules.
setUp ( ) Loads the field type necessary components.

Private Methods

Method Description
_getButtonLabelByType ( $sButtonType, $sUserName, $sValue )
_getCountAPIByType ( $sButtonType, $sUserName, $sRepository )
_getCountHrefByType ( $sButtonType, $sUserName, $sRepository )
_getGitHubAPICountSlugByType ( $sType ) Returns the API count slug used for the given type.
_getGitHubAPISlugByType ( $sType ) Returns the API slug used for the given type.
_getHrefByType ( $sButtonType, $sUserName, $sRepository )
_getIcontByType ( $sButtonType )

Method Details

_replyToAddScript() public method

public _replyToAddScript ( )

construct() protected method

Loaded at the end of the constructor.
protected construct ( )

getEnqueuingScripts() protected method

The returning array should be composed with 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.
  • arguments - ( optional, array ) [3.3.0+] argument array. array( 'async' => '', 'data-id' => '...' )

Example

array( 'src' => dirname( __FILE__ ) . '/asset/github-buttons/buttons.js', 'handle_id' => 'github-bjs', 'in_footer' => true, 'attributes' => array( 'async' => '', 'defer' => '', ), )
protected getEnqueuingScripts ( )

getEnqueuingStyles() protected method

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.
  • arguments - ( optional, array ) [3.3.0+] argument array. array( 'data-id' => '...' )

Example

array( array( 'src' => dirname( __FILE__ ) . '/assets/css/main.css', 'handle_id' => 'custom_button_css', ), );
protected getEnqueuingStyles ( )

getField() protected method

Returns the output of the field type.
protected getField ( $aField )

getIEStyles() protected method

Returns IE specific CSS rules.
protected getIEStyles ( )

getScripts() protected method

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

getStyles() protected method

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

setUp() protected method

This method is triggered when a field definition array that calls this field type is parsed.
protected setUp ( )

Property Details

$_bAddedScriptToFooter public_oe static_oe property

public static $_bAddedScriptToFooter

$aDefaultKeys protected_oe property

The keys are used for the field definition array. $this->addSettingFields( array( 'section_id' => '...', 'type' => '...', 'field_id' => '...', 'my_custom_key' => '...', // <-- THIS PART ) );
protected $aDefaultKeys

$aFieldTypeSlugs public_oe property

The slug is used for the type key in a field definition array. $this->addSettingFields( array( 'section_id' => '...', 'type' => 'github', // <--- THIS PART 'field_id' => '...', 'title' => '...', ) );
public $aFieldTypeSlugs