Class WPDA_Simple_Form_Item_Image
Handles a database column of type image.
author | Peter Schulz |
---|---|
since | 2.5.0 |
package | WPDataAccess\Simple_Form |
inherited_from | \WPDataAccess\Simple_Form\WPDA_Simple_Form_Item_Media |
__construct(array $args = array()
)
Declare item with all its properties.
inherited_from | \WPDataAccess\Simple_Form\WPDA_Simple_Form_Item_Media::__construct() |
---|
array
__construct(array $args = array()
)
Declare item with all its properties.
since | 1.0.0 |
---|
array
[
'item_name' => item name
'data_type' => data type
'item_label' => label
'item_value' => value (in database)
'item_default_value' => default value
'item_extra' => check column extra in information_schema.columns
'item_enum' => enum (if applicable)
'item_enum_options' => enum options (if applicable)
'column_type' => type
'item_event' => JS event(s)
'item_js' => JS code (global)
'item_hide_icon' => icon (showing data type)
'item_class' => css class
'hide_item' => item visibility
'is_nullable' => allow null values?
'is_key_column' => is key column?
].
add_media_library_selection()
Overwrite this method for every new media item.
inherited_from | \WPDataAccess\Simple_Form\WPDA_Simple_Form_Item_Media::add_media_library_selection() |
---|
get_column_type() : string
since | 1.0.0 |
---|
string
get_data_type() : string
since | 1.0.0 |
---|
string
get_hide_item() : boolean
since | 1.6.9 |
---|
boolean
get_item_class() : string
since | 1.0.0 |
---|
string
get_item_default_value() : mixed
since | 1.0.0 |
---|
mixed
get_item_enum() : array
since | 1.0.0 |
---|
array
get_item_event() : String
since | 1.0.0 |
---|
String
get_item_extra() : mixed
get_item_hide_icon() : boolean
since | 1.0.0 |
---|
boolean
get_item_js() : mixed
since | 1.0.0 |
---|
mixed
get_item_label() : string
since | 1.0.0 |
---|
string
get_item_name() : string
since | 1.0.0 |
---|
string
get_item_value() : mixed
since | 1.0.0 |
---|
mixed
is_key_column() : boolean
since | 2.0.0 |
---|
boolean
is_nullable() : boolean
since | 2.0.0 |
---|
boolean
is_valid($pre_insert = false
) : boolean
boolean
set_data_type(string $data_type)
since | 1.6.9 |
---|
string
Item data type
set_enum(string $item_enum)
since | 1.6.9 |
---|
string
Item enum value list
set_hide_item(boolean $hide_item)
since | 1.6.9 |
---|
boolean
TRUE = hide item
set_is_key_column(boolean $is_key_column)
boolean
TRUE|FALSE
set_item_class(string $item_class)
since | 1.6.2 |
---|
string
HTML class name
set_item_default_value(string $item_default_value)
since | 1.6.2 |
---|
string
Default value
set_item_hide_icon(boolean $item_hide_icon)
since | 2.0.8 |
---|
boolean
TRUE = hide type icon behind text field
set_item_js(string $item_js)
since | 1.6.9 |
---|
string
Item specific javascript code
set_item_value(string $value)
string
Item value
set_label(string $label)
string
Item label
show(string $action, string $update_keys_allowed)
string
Requested action
string
TRUE = allow key updates
show_item_media()
Overwrite this method for every new media item.
inherited_from | \WPDataAccess\Simple_Form\WPDA_Simple_Form_Item_Media::show_item_media() |
---|
add_media_library_interaction()
This method: (1) Adds a hidden item holding the media id(s). (2) Adds an upload button to start the interaction with the media library. (3) Adds a remove button to remove the media. (4) Adds a JS function which implements the selection of media in the media library. Uses the hidden media item to select media. (5) Adds a JS function which removes the media. Uses the hidden media item to remove the media. (6) Adds an on click event to the button previously created. Opens the WordPress media library and selects the media id(s) taken from the hidden media item.
All created items have uniques names to prevent issues between them.
If you change this method all media items will be affected!
add_media_library_selection()
Overwrite this method for every new media item.
show_item()
Overwrite this method to define specific item processing like enum, set, image and so on.
show_item_media()
Overwrite this method for every new media item.
$column_type : string
Column type offers more info than data type, like column length or values for enum types.
$data_type : string
$hide_item : boolean
$is_auto_increment : boolean
false
$is_key_column : boolean
$is_nullable : boolean
$item_class : string
$item_default_value : mixed
$item_enum : array
$item_event : array
Add event to item for example: ["onclick" => "check_item_value()"]
$item_extra : string
Like auto_increment, on update, etc
$item_hide_icon : boolean
TRUE = icon is shown after item, FALSE = hide icon (default FALSE)
$item_icon_type : string
$item_js : string
Code is added to the end of the form.
$item_label : string
$item_name : string
$item_placeholder : string
''
$item_value : mixed
$media_frame_remove
$media_frame_title
$media_types
''
$show_context_action : string
$show_context_class_primary_key : string
$show_context_column_value : string
$show_context_item_events : string
$show_context_update_keys_allowed : string