From a09f97d7afcd91d32569f301ba76ef89e49ddc9a Mon Sep 17 00:00:00 2001
From: Brian Miyaji
Date: Thu, 6 Mar 2014 22:39:05 +1100
Subject: [PATCH] Add widget option to show view full table link in league
table
---
admin/templates/league-table.php | 8 +++++++-
admin/widgets/league-table.php | 13 ++++++++++---
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/admin/templates/league-table.php b/admin/templates/league-table.php
index fa5e1cdb..79ccb01d 100644
--- a/admin/templates/league-table.php
+++ b/admin/templates/league-table.php
@@ -7,6 +7,7 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
$defaults = array(
'columns' => null,
+ 'show_full_table_link' => false,
);
$r = wp_parse_args( $args, $defaults );
@@ -58,7 +59,12 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
endforeach;
- $output .= '' . '' . '';
+ $output .= '' . '';
+
+ if ( $r['show_full_table_link'] )
+ $output .= '' . __( 'View full table', 'sportspress' ) . '';
+
+ $output .= '';
return apply_filters( 'sportspress_league_table', $output, $id );
diff --git a/admin/widgets/league-table.php b/admin/widgets/league-table.php
index e8974c8b..6c4abb0f 100644
--- a/admin/widgets/league-table.php
+++ b/admin/widgets/league-table.php
@@ -10,12 +10,13 @@ class SportsPress_Widget_League_Table extends WP_Widget {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$id = empty($instance['id']) ? null : $instance['id'];
- $columns = $instance['columns'];
+ $columns = empty($instance['columns']) ? null : $instance['columns'];
+ $show_full_table_link = empty($instance['show_full_table_link']) ? false : $instance['show_full_table_link'];
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo '';
- echo sportspress_league_table( $id, array( 'columns' => $columns ) );
+ echo sportspress_league_table( $id, array( 'columns' => $columns, 'show_full_table_link' => $show_full_table_link ) );
echo '
';
echo $after_widget;
}
@@ -25,15 +26,17 @@ class SportsPress_Widget_League_Table extends WP_Widget {
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['columns'] = (array)$new_instance['columns'];
+ $instance['show_full_table_link'] = $new_instance['show_full_table_link'];
return $instance;
}
function form( $instance ) {
- $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'columns' => null ) );
+ $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'columns' => null, 'show_full_table_link' => true ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$columns = $instance['columns'];
+ $show_full_table_link = $instance['show_full_table_link'];
?>
@@ -73,6 +76,10 @@ class SportsPress_Widget_League_Table extends WP_Widget {
+
+ >
+
+