Control: Media - 10quality/wpmvc-addon-administrator GitHub Wiki
Control used as a field type to display media (call to Media uploader / Media Library).
Usage
// Namespace and use statement...
class Settings extends Model
{
// Class properties...
protected function init()
{
// Other properties...
$this->tabs = [
'tab_id' => [
'fields' => [
'image' => [
'type' => 'media',
'title' => __( 'Image' ),
],
'file_url' => [
'type' => 'media',
'title' => __( 'File URL' ),
'description' => __( 'Custom file upload.' ),
'control' => [
'wide' => true,
'button_label' => __( 'Add file' ),
'icon' => 'fa-file',
'attributes' => [
'data-show-input' => 1,
'data-id-value' => 0,
],
],
]
// Other fields...
],
],
];
}
}
Control options
Control | Data type | Description |
---|---|---|
wide |
bool |
Flag that indicates if the input (is not hidden) should display wider or small. |
show_icon |
bool |
Flag that indicates if the button should display media icon. Default: true |
icon |
string |
Font awesome v4 icon. |
button_label |
string |
Button label. Default: Add media |
attributes |
array |
List of HTML attributes to set control options (see the list of options here). Skip data-editor , name , and value as this are set by the addon automatically. |