| 1 |
<?php |
| 2 |
/** |
| 3 |
* Display the main settings page wrapper. |
| 4 |
* |
| 5 |
* @author Eric Daams |
| 6 |
* @package Charitable/Admin View/Settings |
| 7 |
* @copyright Copyright (c) 2018, Studio 164a |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.0.0 |
| 10 |
* @version 1.6.0 |
| 11 |
*/ |
| 12 |
|
| 13 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general'; |
| 14 |
$group = isset( $_GET['group'] ) ? $_GET['group'] : $active_tab; |
| 15 |
$sections = charitable_get_admin_settings()->get_sections(); |
| 16 |
|
| 17 |
ob_start(); |
| 18 |
?> |
| 19 |
<div id="charitable-settings" class="wrap"> |
| 20 |
<h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></ha> |
| 21 |
<h2 class="nav-tab-wrapper"> |
| 22 |
<?php foreach ( $sections as $tab => $name ) : ?> |
| 23 |
<a href="<?php echo esc_url( add_query_arg( array( 'tab' => $tab ), admin_url( 'admin.php?page=charitable-settings' ) ) ); ?>" class="nav-tab <?php echo $active_tab == $tab ? 'nav-tab-active' : ''; ?>"><?php echo $name; ?></a> |
| 24 |
<?php endforeach ?> |
| 25 |
</h2> |
| 26 |
<?php if ( $group != $active_tab ) : ?> |
| 27 |
<?php /* translators: %s: active settings tab label */ ?> |
| 28 |
<p><a href="<?php echo esc_url( add_query_arg( array( 'tab' => $active_tab ), admin_url( 'admin.php?page=charitable-settings' ) ) ); ?>"><?php printf( __( '← Return to %s', 'charitable' ), $sections[ $active_tab ] ); ?></a></p> |
| 29 |
<?php endif ?> |
| 30 |
<?php |
| 31 |
/** |
| 32 |
* Do or render something right before the settings form. |
| 33 |
* |
| 34 |
* @since 1.0.0 |
| 35 |
* |
| 36 |
* @param string $group The settings group we are viewing. |
| 37 |
*/ |
| 38 |
do_action( 'charitable_before_admin_settings', $group ); |
| 39 |
?> |
| 40 |
<form method="post" action="options.php"> |
| 41 |
<table class="form-table"> |
| 42 |
<?php |
| 43 |
settings_fields( 'charitable_settings' ); |
| 44 |
|
| 45 |
charitable_do_settings_fields( 'charitable_settings_' . $group, 'charitable_settings_' . $group ); |
| 46 |
?> |
| 47 |
</table> |
| 48 |
<?php |
| 49 |
/** |
| 50 |
* Filter the submit button at the bottom of the settings table. |
| 51 |
* |
| 52 |
* @since 1.6.0 |
| 53 |
* |
| 54 |
* @param string $button The button output. |
| 55 |
*/ |
| 56 |
echo apply_filters( 'charitable_settings_button_' . $group, get_submit_button( null, 'primary', 'submit', true, null ) ); |
| 57 |
?> |
| 58 |
</form> |
| 59 |
<?php |
| 60 |
/** |
| 61 |
* Do or render something right after the settings form. |
| 62 |
* |
| 63 |
* @since 1.0.0 |
| 64 |
* |
| 65 |
* @param string $group The settings group we are viewing. |
| 66 |
*/ |
| 67 |
do_action( 'charitable_after_admin_settings', $group ); |
| 68 |
?> |
| 69 |
</div> |
| 70 |
<?php |
| 71 |
echo ob_get_clean(); |
| 72 |
|