Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak - Test email input and button design #1280

Merged
60 changes: 58 additions & 2 deletions includes/admin/class-evf-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public static function output_fields( $options ) {
case 'title':
if ( ! empty( $value['title'] ) ) {
$tabs = apply_filters( 'everest_forms_settings_tabs_array', array() );
$current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
$current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
$tabs_array = array();
if ( isset( $tabs[ $current_tab ] ) ) {
$tabs_array[ $current_tab ] = isset( $tabs_array[ $current_tab ] ) ? $tabs_array[ $current_tab ] : array();
Expand Down Expand Up @@ -810,8 +810,64 @@ class="<?php echo esc_attr( $value['class'] ); ?>"
</div>
<?php
break;
case 'input_test_button':
$option_value = $value['value'];
$visibility_class = array();

// Default: run an action.
if ( isset( $value['is_visible'] ) ) {
$visibility_class[] = $value['is_visible'] ? 'everest-forms-visible' : 'everest-forms-hidden';
}

if ( empty( $option_value ) ) {
$option_value = $value['default'];
}

?>
<div class="everest-forms-global-settings <?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>">
<label for="<?php echo esc_attr( $value['input_id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo wp_kses_post( $tooltip_html ); ?></label>
<div class="everest-forms-global-settings--field forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
<input
name="<?php echo esc_attr( $value['input_id'] ); ?>"
id="<?php echo esc_attr( $value['input_id'] ); ?>"
type="<?php echo esc_attr( $value['input_type'] ); ?>"
style="<?php echo esc_attr( $value['input_css'] ); ?>"
value="<?php echo esc_attr( $option_value ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>"
placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
<?php
if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) {
foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
echo esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
}
}
?>
/><?php echo esc_html( $value['suffix'] ); ?> <?php echo wp_kses_post( $description ); ?>
<?php
if ( isset( $value['buttons'] ) && is_array( $value['buttons'] ) ) {
foreach ( $value['buttons'] as $button ) {
?>
<a href="<?php echo esc_url( $button['href'] ); ?>" class="button <?php echo esc_attr( $button['class'] ); ?>"
style="<?php echo esc_attr( $value['button_css'] ); ?>"
<?php
if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) {
foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
echo esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
}
}
?>
>
<?php echo esc_html( $button['title'] ); ?>
</a>
<?php
}
}
?>
<?php echo esc_html( $value['suffix'] ); ?> <?php echo wp_kses_post( $description ); ?>
</div>
</div>
<?php
break;
// Default: run an action.
default:
do_action( 'everest_forms_admin_field_' . $value['type'], $value );
break;
Expand Down
23 changes: 9 additions & 14 deletions includes/admin/settings/class-evf-settings-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,30 @@ public function get_settings() {
),
array(
'title' => esc_html__( 'Enable copies', 'everest-forms' ),
'desc' => esc_html__( 'Enable the use of Cc and Bcc email addresses', 'everest-forms' ),
'desc_tip' => esc_html__( 'Email addresses for Cc and Bcc can be applied from the form notification settings.', 'everest-forms' ),
'desc' => esc_html__( 'Email addresses for Cc and Bcc can be applied from the form notification settings.', 'everest-forms' ),
'id' => 'everest_forms_enable_email_copies',
'default' => 'no',
'type' => 'toggle',
'desc_tip' => true,
),
array(
'title' => esc_html__( 'Send Test Email To', 'everest-forms' ),
'desc' => esc_html__( 'Enter email address where test email will be sent.', 'everest-forms' ),
'id' => 'everest_forms_email_send_to',
'type' => 'email',
'desc' => esc_html__( 'Enter the email address where test email will be sent.', 'everest-forms' ),
'input_id' => 'everest_forms_email_send_to',
'placeholder' => 'eg. testemail@gmail.com',
'input_type' => 'email',
'value' => get_option( 'everest_forms_email_send_to', '' ) ? esc_attr( get_option( 'everest_forms_email_send_to', '' ) ) : esc_attr( get_bloginfo( 'admin_email' ) ),
'desc_tip' => true,
),
array(
'title' => __( 'Send Test Email', 'everest-forms' ),
'desc' => __( 'Click to send test email.', 'everest-forms' ),
'id' => 'everest_forms_email_test',
'type' => 'link',
'buttons' => array(
'button_id' => 'everest_forms_email_test',
'type' => 'input_test_button',
'input_css' => 'margin-right:0.5rem',
'buttons' => array(
array(
'title' => __( 'Send Test Email', 'everest-forms' ),
'href' => 'javascript:;',
'class' => 'everest_forms_send_email_test',
),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
'type' => 'sectionend',
Expand Down
18 changes: 7 additions & 11 deletions includes/admin/settings/class-evf-settings-reporting.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,21 @@ public function get_settings() {
array(
'title' => esc_html__( 'Send Test Email To', 'everest-forms' ),
'desc' => esc_html__( 'Enter email address where test email will be sent.', 'everest-forms' ),
'id' => 'everest_forms_email_send_to',
'type' => 'email',
'input_id' => 'everest_forms_email_send_to',
'input_type' => 'email',
'input_css' => 'margin-right:0.5rem',
'placeholder' => 'eg. testemail@gmail.com',
'value' => ! empty( $evf_summary_email ) ? esc_attr( $evf_summary_email ) : esc_attr( get_bloginfo( 'admin_email' ) ),
'desc_tip' => true,
),
array(
'title' => __( 'Send Test Email', 'everest-forms' ),
'desc' => __( 'Click to send test email.', 'everest-forms' ),
'id' => 'everest_forms_send_routine_report_test_email',
'type' => 'link',
'buttons' => array(
'button_id' => 'everest_forms_send_routine_report_test_email',
'type' => 'input_test_button',
'buttons' => array(
array(
'title' => __( 'Send Test Email', 'everest-forms' ),
'href' => 'javascript:;',
'class' => 'everest_forms_send_routine_report_test_email',
),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
'title' => esc_html__( 'Report Form Lists', 'everest-forms' ),
Expand Down
Loading