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. Defaulttrue
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 theinput
tag.preview
- (array) The HTML attributes applied to thepreview
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
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
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
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.
|