From 58e57e2ed05780c55b0f8dc4758873f41f79e0f6 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Wed, 15 Nov 2017 00:12:09 +1100 Subject: [PATCH] Add filters to table --- .../class-sp-meta-box-table-data.php | 59 ++++++++++++------- .../class-sp-meta-box-table-details.php | 1 + includes/sp-core-functions.php | 4 +- 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php index 1939a179..d660c862 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php @@ -39,7 +39,7 @@ class SP_Meta_Box_Table_Data { /** * Admin edit table */ - public static function table( $id, $columns = array(), $usecolumns = null, $data = array(), $placeholders = array(), $adjustments = array(), $highlight = null ) { + public static function table( $id, $columns = array(), $usecolumns = null, $data = array(), $placeholders = array(), $adjustments = array(), $highlight = null, $readonly = false ) { if ( is_array( $usecolumns ) ) $usecolumns = array_filter( $usecolumns ); @@ -53,20 +53,33 @@ class SP_Meta_Box_Table_Data { $icon_class = 'sp-icon-shield'; } ?> - - + + +

+ + +

+ + + + +
- + + + $label ): ?> @@ -85,25 +98,31 @@ class SP_Meta_Box_Table_Data { $default_name = get_the_title( $team_id ); ?> - + + + $label ): $value = sp_array_value( $team_stats, $column, '' ); $placeholder = sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $column, 0 ); $placeholder = wp_strip_all_tags( $placeholder ); ?> - + - diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php index f50f490a..6e11ffe2 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php @@ -72,6 +72,7 @@ class SP_Meta_Box_Table_Details { foreach ( $taxonomies as $taxonomy ) { sp_taxonomy_field( $taxonomy, $post, true ); } + do_action( 'sportspress_meta_box_table_details', $post->ID ); ?>

ID ); ?> diff --git a/includes/sp-core-functions.php b/includes/sp-core-functions.php index 9b8844ca..2a246d71 100644 --- a/includes/sp-core-functions.php +++ b/includes/sp-core-functions.php @@ -1136,14 +1136,14 @@ if ( !function_exists( 'sp_get_var_equations' ) ) { } if ( !function_exists( 'sp_post_adder' ) ) { - function sp_post_adder( $post_type = 'post', $label = null ) { + function sp_post_adder( $post_type = 'post', $label = null, $attributes = array() ) { $obj = get_post_type_object( $post_type ); if ( $label == null ) $label = __( 'Add New', 'sportspress' ); ?>

> > - - - - - + + + + + + + + + />
+