Class WPDP_Project_Table_View extends WPDA_List_View
A list view is an object that consists of a WordPress list table and it's screen options (displayed in the top right corner). The list view combines these options by identifying the different stages that apply to building a page containing both.
Stages:
To make sure that screen options are displayed with the list table, the constructor is called in the 'admin_menu' hook \WP_Data_Access::define_admin_hooks(). A object reference is stored in the class and used later when the list table is created on the page displayed.
see | \WPDataAccess\List_Table\WPDA_List_View |
---|---|
author | Peter Schulz |
since | 2.0.0 |
package | WPDataProjects\Project |
inherited_from | \WPDataAccess\List_Table\WPDA_List_View |
__construct(array $args = array()
)
Page hook suffix
We first check if we have a page hook suffix. This is the reference to the sub menu to which we want to add the list view. If no page hook suffix is provided, the list table might be displayed as expected, the screen options in the top right corner however will not be shown.
Database table usage
Table names are always checked! We need to check:
These checks are performed to prevent SQL injection and misuse of our WordPress database. These checks however are not performed in this class. They are performed in class \WPDataAccess\List_Table\WPDA_List_Table as we do not perform any queries in this class. We do perform queries on the given tables in \WPDataAccess\List_Table\WPDA_List_Table.
see | \WPDataAccess\List_Table\WPDA_List_Table |
---|---|
since | 1.0.0 |
array
[
'page_hook_suffix' => (string|boolean) Page hook suffix of false (default = false)
'schema_name' => (string) Database schema name (default = '')
'table_name' => (string) Database table name (default = '')
'bulk_actions_enabled' => (boolean) Allow bulk actions? (default = TRUE)
'search_box_enabled' => (boolean) Show search box? (default = TRUE)
'bulk_export_enabled' => (boolean) Allow bulk exports? (default = TRUE)
'list_table_class' => (string) Class providing list table functionality
'edit_form_class' => (string) Class providing data entry functionality
'column_headers' => (array|string) Column headers (default = '' : headers taken from data dictionary)
'title' => (string) Page title (default = null)
'subtitle' => (string) Page subtitle (default = null)
'show_view_link' => (string) default = 'on'
'allow_insert' => (string) default = 'off'
'allow_update' => (string) default = 'off'
'allow_delete' => (string) default = 'off'
'allow_import' => (string) default = 'off'
'default_where' => (string)
]
get_column_headers() : array
since | 1.0.0 |
---|
array
set_bulk_actions_enabled(boolean $bulk_actions_enabled)
If enabled user can perform actions on multiple rows at once.
since | 1.0.0 |
---|
boolean
TRUE = allow bulk actions, FALSE = no bulk actions.
set_columns_queried(mixed $columns_queried)
If not set all column (*) will be selected/set/queried.
since | 1.0.0 |
---|
mixed
Column array, '' or '*'.
set_screen_option(string $status, string $option, mixed $value) : mixed
since | 1.0.0 |
---|
string
Not used.
string
string Not used.
mixed
Option value.
mixed
set_search_box_enabled(boolean $search_box_enabled)
Shows a search box if enabled. In WP Data Access only columns with data type varchar or enum are searched.
since | 1.0.0 |
---|
boolean
TRUE = show search box, FALSE = no search box.
show()
Page types to be displayed:
The type of table displayed depend on the value of the action argument provided in the request. The value of argument action is stored in $this->action in the constructor.
inherited_from | \WPDataAccess\List_Table\WPDA_List_View::show() |
---|
show()
Page types to be displayed:
The type of table displayed depend on the value of the action argument provided in the request. The value of argument action is stored in $this->action in the constructor.
since | 1.0.0 |
---|
display_edit_form()
Called when action is:
Class WPDA_Simple_Form is the default class used to generate data entry forms. This class provides dynamic generation of data entry forms for any table, as long as the table has a primary key. The primary key is necessary to perform updates (unique identification of records).
For more specific data entry forms WPDA_Simple_Form can be extended. These classes need to implement some methods to work properly. Check out \WPDataAccess\Simple_Form\WPDA_Simple_Form for more information.
since | 1.0.0 |
---|---|
see | \WPDataAccess\Simple_Form\WPDA_Simple_Form |
display_list_table()
There are two type of list tables here:
A list of tables in the WordPress database schema is in fact a list of rows as well. The MySQL base table (which is in fact a view) used to show this information is 'information_schema.tables'. The list of tables contains a link to a list table for every table.
The list of rows is provided by class \WPDataAccess\List_Table\WPDA_List_Table. WPDA_List_Table extends Wordprees class WP_List_Table.
The list of tables is provided by class \WPDataAccess\List_Table\WPDA_List_Table_Menu. WPDA_List_Table_Menu extends class WPDA_List_Table.
since | 1.0.0 |
---|---|
see | \WPDataAccess\List_Table\WPDA_List_Table |
see | \WPDataAccess\List_Table\WPDA_List_Table_Menu |
$action : string
''
$allow_delete : string
null
$allow_import : string
null
$allow_insert : string
null
$allow_update : string
null
$bulk_actions_enabled : boolean
$bulk_export_enabled : boolean
$child_request : boolean | string
false
I don't like this kind of programming! This should be in child class of course! The load action to add screen options however cannot be delayed and therefor must be in the parent call.
$column_headers : string
$default_where : string
''
$edit_form_class : string
$list_table_class : string
$page_hook_suffix : object | boolean
$schema_name : string
$screen_settings_saved
false
$search_box_enabled : boolean
$show_view_link : string
null
$subtitle : string
$table_name : string
$title : string
$wpda_list_columns : \WPDataAccess\Data_Dictionary\WPDA_List_Columns
null
$wpda_list_table : \WPDataAccess\List_Table\WPDA_List_Table | \WPDataAccess\List_Table\WPDA_List_Table_Menu
HIDDENCOLUMNS_PREFIX = 'wpda_manage_columnshidden_'