Admin Page Framework - Field Type Pack Documentation
  • Package
  • Class

Packages

  • AdminPageFrameworkFieldTypePack
    • CustomFieldType

Classes

  • AutoCompleteCustomFieldType
  • DateCustomFieldType
  • DateRangeCustomFieldType
  • DateTimeCustomFieldType
  • DateTimeRangeCustomFieldType
  • DialCustomFieldType
  • EDDSoftwareLicensingCustomFieldType
  • FontCustomFieldType
  • GeometryCustomFieldType
  • GridCustomFieldType
  • ImageCheckboxCustomFieldType
  • ImageRadioCustomFieldType
  • LinkCustomFieldType
  • RevealerCustomFieldType
  • TimeCustomFieldType
  • TimeRangeCustomFieldType

Class FontCustomFieldType

Defines the font field type.

This field type allows the user upload a font file to the site with a preview.

Field Type Specific Arguments

  • show_preview - (boolean) Whether to show the font preview. Default: true
  • allow_external_source - (boolean) Whether to allow external font urls to be set in the uploader. Default true
  • preview_text - (string) The preview text.
  • attributes - (array) The array that defines the HTML attributes of the field elements.
    • input - (array) The HTML attributes applied to the input tag.
    • preview - (array) The HTML attributes applied to the preview element.
    • button - (array) The HTML attributes applied to the Select button.
    • remove_button - (array) The HTML attributes applied to the Remove button.

Example

array(
    'field_id'      => 'font_field',
    'section_id'    => 'font',
    'title'         => __( 'Font Upload', 'admin-page-framework-field-type-pack' ),
    'type'          => 'font',
    'description'   => __( 'Set the URL of the font.', 'admin-page-framework-field-type-pack' ),
),
array(
    'field_id'      => 'font_field_repeatable',
    'title'         => __( 'Repeatable', 'admin-page-framework-field-type-pack' ),
    'type'          => 'font',
    'repeatable'    => true,
    'attributes'    => array(
        'button'            =>  array(
            'data-label'    => __( 'Select Font', 'admin-page-framework-field-type-pack' ),
        ),
        'remove_button'     =>  array(
            'data-label'    => __( 'Remove Font', 'admin-page-framework-field-type-pack' ),
        )
    ),
),
array(
    'field_id'      => 'font_field_sortable',
    'title'         => __( 'Sortable', 'admin-page-framework-field-type-pack' ),
    'type'          => 'font',
    'sortable'      =>  true,
    array(), // second
    array(), // third
)
Package: AdminPageFrameworkFieldTypePack\CustomFieldType
Since: 1.0.0
Located at custom-field-types/font-custom-field-type/FontCustomFieldType.php

Methods summary

protected
# construct( )

The user constructor.

Remark

This must be instantiated also in in ...wp-admin/async-upload.php to modify the allowed mime types.
public
# replyToFilterUploadMimes( mixed $aMimes )

This allows several file types to be uploaded with the WordPress media uploader.

protected
# setUp( )

Loads the field type necessary components.

protected
# getEnqueuingScripts( )

Returns an array holding the urls of enqueuing scripts.

protected
# getEnqueuingStyles( )

Returns an array holding the urls of enqueuing styles.

protected
# getScripts( )

Returns the field type specific JavaScript script.

protected
# getScript_CreateSlider( )
protected
# getScript_RepeatableFields( )
protected
# getIEStyles( )

Returns IE specific CSS rules.

protected
# getStyles( )

Returns the field type specific CSS rules.

protected
# getField( mixed $aField )

Returns the output of the field type.

protected
# getExtraInputFields( mixed & $aField )

Returns extra input fields to set capturing attributes.

Since

3.0.0
protected
# _getPreviewContainer( mixed $aField, mixed $sFontURL, mixed $aPreviewAtrributes )

Returns the output of the preview box.

Since

3.0.0
protected
# _getUploaderButtonScript( mixed $sInputID, mixed $bRpeatable, mixed $bExternalSource, array $aButtonAttributes )

A helper function for the above getImageInputTags() method to add a image button script.

Since

2.1.3
2.1.5 Moved from AdminPageFramework_InputField.
protected
# _getRemoveButtonScript( mixed $sInputID, array $aButtonAttributes )

Removes the set image values and attributes.

Since

3.2.0

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.
Admin Page Framework - Field Type Pack Documentation generated by ApiGen 2.8.0