Class WPDA_Publisher_Form extends WPDA_Simple_Form
Data entry form which allows users to create, update and test publications. A publication consists of a database table, a number of columns and some options. A shortcode can be generated for a publication. The shortcode can be copied to the clipboard and from there pasted in a WordPress post or page. The shortcode is used to add a dynamic HTML table to a post or page that supports searching, pagination and sorting. Tables are created with jQuery DataTables.
author | Peter Schulz |
---|---|
since | 2.0.15 |
package | WPDataAccess\Data_Publisher |
inherited_from | \WPDataAccess\Simple_Form\WPDA_Simple_Form |
__construct(string $schema_name, string $table_name, object $wpda_list_columns, array $args = array()
)
Performs the following steps:
inherited_from | \WPDataAccess\Simple_Form\WPDA_Simple_Form::__construct() |
---|
string
Database schema name
string
Database table name
object
Handle to instance of WPDA_List_Columns
array
__construct(string $schema_name, string $table_name, \WPDataAccess\Data_Dictionary\WPDA_List_Columns $wpda_list_columns, array $args = array()
)
Performs the following steps:
since | 1.0.0 |
---|---|
see | \WPDataAccess\Simple_Form\WPDA_Simple_Form_Data |
string
Database schema name.
string
Database table name.
\WPDataAccess\Data_Dictionary\WPDA_List_Columns
Reference to column array.
array
Messages (named array).
add_form_logic()
since | 2.0.15 |
---|
count() : integer
since | 2.0.15 |
---|
integer
get_form_action() : string
since | 1.0.0 |
---|
string
Primary page actionget_form_action2() : string
since | 1.0.0 |
---|
string
Secondary page actionget_new_value(string $column_name) : mixed | string
Or empty if no new value available.
since | 1.0.0 |
---|
string
Column name.
mixed
string
New value for column or empty.get_old_value(string $column_name) : mixed | string
Or empty if no old value available.
since | 1.0.0 |
---|
string
Column name.
mixed
string
Old value for column or empty.hide_items(array $items_to_hide)
since | 2.0.15 |
---|
array
Arrays contains item names of items that should be defined as hidden
prepare_items(boolean $set_back_form_values = false
)
If you want to change the layout of your simple form(s), consider to extend class WPDA_Simple_Form and override this method.
inherited_from | \WPDataAccess\Simple_Form\WPDA_Simple_Form::prepare_items() |
---|
boolean
set_labels(array $item_labels)
since | 2.0.15 |
---|
array
Named array containing item name/label pairs
show(boolean $allow_save= true
, string $add_param= ''
)
Performs the following steps:
inherited_from | \WPDataAccess\Simple_Form\WPDA_Simple_Form::show() |
---|
boolean
string
show(boolean $allow_save= true
, string $add_param= ''
)
Performs the following steps:
since | 1.0.0 |
---|
boolean
Allow to save data
string
Parameter to be added to form action.
show_publication($pub_id, $table_name)
add_dummy_column(string $column_name)
since | 1.0.0 |
---|
string
Column name.
add_form_item(integer $index, \WPDataAccess\Simple_Form\WPDA_Simple_Form_Item $item)
since | 1.0.0 |
---|---|
see | \WPDataAccess\Simple_Form\WPDA_Simple_Form_Item |
integer
Item sequence number.
\WPDataAccess\Simple_Form\WPDA_Simple_Form_Item
Reference to simple form item.
add_parent_args()
Overwrite this function if you want to use the form as a child form related to some parent form. You can add parent arguments to calls to make sure you get back to the right parent.
since | 1.5.0 |
---|
get_all_db_tables(string $database) : array
string
Database schema name
array
get_column_position(array $column_array = array()
, string $column_name) : integer
since | 1.0.0 |
---|
array
Column array.
string
Column name.
integer
Position of $column_name in $column_arrayget_item_index(string $item_name) : boolean | integer
since | 2.0.15 |
---|
string
Form item name
boolean
integer
Position item or false if not foundget_nonce_action(boolean $use_old_value = true
) : string
Set wp_nonce action for security check: prefix + table name + primary key values
since | 1.0.0 |
---|
boolean
TRUE = use old key values, FALSE = use new key values.
string
wp_nonce action holding: prefix + table name + primary key values.get_url_arguments()
since | 1.5.0 |
---|
is_key_column(string $column_name) : boolean
since | 1.0.0 |
---|
string
Column name.
boolean
TRUE = column is part of primary key, FALSE = column is not part of primary key.order_and_filter_columns(array $columns_ordered)
Reorders the column array in the order as defined in argument $columns_ordered.
since | 1.0.0 |
---|
array
Ordered column names.
prepare_form($allow_save = true
)
prepare_items(boolean $set_back_form_values = false
)
If you want to change the layout of your simple form(s), consider to extend class WPDA_Simple_Form and override this method.
since | 1.0.0 |
---|
boolean
TRUE = set back user entered value, FALSE = set to database value.
prepare_row()
Handle insert, update and save diffently.
since | 1.0.0 |
---|
set_update_keys(boolean $update_keys_allowed)
since | 1.0.0 |
---|
boolean
Allow keys to be updated.
validate(boolean $pre_insert = false
) : boolean
Called to perform default validation before insert and update.
Extend class WPDA_Simple_Form and override this method if you need validation on insert and/or update or if you prefer to change error messages. If you want to handle inserts and updates differently, the following information might be helpful:
Use set_message to show messages (info as well as error).
since | 1.0.0 |
---|
boolean
Do not check auto_increment during pre-insert
boolean
TRUE = validation succeeded, FALSE = validation failed.$action : string
$action2 : string
''
$add_action_to_title : string
$auto_increment_value : integer
-1
$back_to_list_text : string
''
$check_table_type : boolean
true
$column_headers : array
$current_form_id : integer
$database_tables
array()
$fieldset_title : string
''
$form_id : integer
0
$form_items : array
array()
$form_items_named : array
array()
Use this array to quickly find an item in the form
$form_items_new_values : array
array()
$form_items_old_values : array
array()
$help_url : null | string
null
$hide_add_new : null | string
false
$hyperlinks
array()
$no_warning_update_text : string
'FALSE'
$page : string
$page_number_item : null
''
$page_number_item_name : string
'page_number'
The name can be changed for pages on multiple levels. This is needed to get back to the right page in parent-child page.
$page_number_link : null
''
$row : object
$row_data : \WPDataAccess\Simple_Form\WPDA_Simple_Form_Data
$schema_name : string
$show_back_icon : boolean
true
$show_title : boolean
true
$subtitle : string
''
$table_column_header : array
$table_column_headers : array
$table_columns : array
$table_name : string
$title : string
null
$update_keys_allowed : boolean
false
$wpda_err : integer
0
$wpda_list_columns : \WPDataAccess\Data_Dictionary\WPDA_List_Columns
$wpda_msg : string
''
$wpda_table_settings : mixed | null
null
WARNING_ICON = '<span class="dashicons dashicons-warning"></span> '