| 1 |
<?php |
| 2 |
/** |
| 3 |
* Display WP Editor in a settings field. |
| 4 |
* |
| 5 |
* @author Eric Daams |
| 6 |
* @package Charitable/Admin View/Settings |
| 7 |
* @copyright Copyright (c) 2019, Studio 164a |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.0.0 |
| 10 |
* @version 1.0.0 |
| 11 |
*/ |
| 12 |
|
| 13 |
$value = charitable_get_option( $view_args['key'] ); |
| 14 |
|
| 15 |
if ( empty( $value ) ) : |
| 16 |
$value = isset( $view_args['default'] ) ? $view_args['default'] : ''; |
| 17 |
endif; |
| 18 |
|
| 19 |
$editor_args = isset( $view_args['editor'] ) ? $view_args['editor'] : array(); |
| 20 |
$default_editor_args = array( |
| 21 |
'textarea_name' => sprintf( 'charitable_settings[%s]', $view_args['name'] ), |
| 22 |
); |
| 23 |
$editor_args = wp_parse_args( $editor_args, $default_editor_args ); |
| 24 |
|
| 25 |
wp_editor( $value, sprintf( 'charitable_settings_%s', implode( '_', $view_args['key'] ) ), $editor_args ); |
| 26 |
|
| 27 |
if ( isset( $view_args['help'] ) ) : ?> |
| 28 |
<div class="charitable-help"><?php echo $view_args['help']; ?></div> |
| 29 |
<?php |
| 30 |
endif; |
| 31 |
|