Add in editor for fields
This commit is contained in:
@ -343,10 +343,16 @@ class CWV2_Admin {
|
|||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'd_msg',
|
'id' => 'd_msg',
|
||||||
'name' => __( 'Dialog Message', 'content-warning-v2' ),
|
'name' => __( 'Dialog Message', 'content-warning-v2' ),
|
||||||
'desc' => __( 'A message shown to your visitor.', 'content-warning-v2' ),
|
'desc' => __( 'A message shown to your visitor.', 'content-warning-v2' ),
|
||||||
'type' => 'editor',
|
'type' => 'editor',
|
||||||
|
'options' => array(
|
||||||
|
'textarea_rows' => 10,
|
||||||
|
),
|
||||||
|
'options' => array(
|
||||||
|
'textarea_rows' => 10,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'exit_txt',
|
'id' => 'exit_txt',
|
||||||
@ -400,10 +406,13 @@ class CWV2_Admin {
|
|||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'den_msg',
|
'id' => 'den_msg',
|
||||||
'name' => __( 'Denial Message', 'content-warning-v2' ),
|
'name' => __( 'Denial Message', 'content-warning-v2' ),
|
||||||
'desc' => __( '', 'content-warning-v2' ),
|
'desc' => __( '', 'content-warning-v2' ),
|
||||||
'type' => 'editor',
|
'type' => 'editor',
|
||||||
|
'options' => array(
|
||||||
|
'textarea_rows' => 10,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'bg_image',
|
'id' => 'bg_image',
|
||||||
@ -416,10 +425,10 @@ class CWV2_Admin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'bg_opacity',
|
'id' => 'bg_opacity',
|
||||||
'name' => __( 'Background Opacity', 'content-warning-v2' ),
|
'name' => __( 'Background Opacity', 'content-warning-v2' ),
|
||||||
'desc' => __( 'Input a float value from 0-1, the latter being completely opaque.', 'content-warning-v2' ),
|
'desc' => __( 'Input a float value from 0-1, the latter being completely opaque.', 'content-warning-v2' ),
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'step' => 0.1,
|
'step' => 0.1,
|
||||||
'max' => 1,
|
'max' => 1,
|
||||||
@ -437,10 +446,10 @@ class CWV2_Admin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'css',
|
'id' => 'css',
|
||||||
'name' => __( 'Custom CSS', 'content-warning-v2' ),
|
'name' => __( 'Custom CSS', 'content-warning-v2' ),
|
||||||
'desc' => __( 'For a completely custom look, just drop your css here.', 'content-warning-v2' ),
|
'desc' => __( 'For a completely custom look, just drop your css here.', 'content-warning-v2' ),
|
||||||
'type' => 'textbox',
|
'type' => 'textbox',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'rows' => 10,
|
'rows' => 10,
|
||||||
'cols' => 100,
|
'cols' => 100,
|
||||||
|
@ -272,6 +272,23 @@ class CWV2_Settings {
|
|||||||
|
|
||||||
public function editor( $args = array() ) {
|
public function editor( $args = array() ) {
|
||||||
|
|
||||||
|
$args = $this->get_default_args( $args );
|
||||||
|
|
||||||
|
$field_id = $args['id'];
|
||||||
|
$description = $args['desc'];
|
||||||
|
$default = empty( $args['default'] ) ? '' : $args['default'];
|
||||||
|
$options = empty( $args['options'] ) ? array() : $args['options'];
|
||||||
|
if ( empty( $field_id ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$option_value = get_option( $field_id, $field_id, $default );
|
||||||
|
|
||||||
|
wp_editor( $option_value, $field_id, $options );
|
||||||
|
|
||||||
|
if ( ! empty( $description ) ) {
|
||||||
|
?><p class="description"><?php echo $description; ?></p><?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user