| 1 |
<?php |
| 2 |
defined('ABSPATH') || die(); |
| 3 |
/* |
| 4 |
* A template, included from inside a class method - never loaded on its own. |
| 5 |
* The variables below are locals of the method that includes it, not globals, |
| 6 |
* which is what the prefix sniff assumes about a file-scope assignment. |
| 7 |
*/ |
| 8 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- included from within a method, so these are function locals. |
| 9 |
|
| 10 |
// The unprefixed filter this file shipped with, still applied so an add-on |
| 11 |
// written against it keeps working. |
| 12 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- kept for backward compatibility; hashform_confirmation_types is the prefixed name to use. |
| 13 |
$hf_confirmation_types = apply_filters('hf_confirmation_types', array( |
| 14 |
'show_message' => __('Message', 'hash-form'), |
| 15 |
'show_page' => __('Show Page', 'hash-form'), |
| 16 |
'redirect_url' => __('Redirect URL', 'hash-form'), |
| 17 |
)); |
| 18 |
|
| 19 |
/** |
| 20 |
* The ways a form can respond once it has been submitted. |
| 21 |
* |
| 22 |
* @param array $hf_confirmation_types Type key => label. |
| 23 |
*/ |
| 24 |
$hf_confirmation_types = apply_filters('hashform_confirmation_types', $hf_confirmation_types); |
| 25 |
?> |
| 26 |
|
| 27 |
<div class="hf-form-container"> |
| 28 |
<div class="hf-form-row"> |
| 29 |
<label><?php esc_html_e('Confirmation Type', 'hash-form'); ?></label> |
| 30 |
<select name="confirmation_type" data-condition="toggle" id="hf-form-conformation-type"> |
| 31 |
<?php |
| 32 |
foreach ($hf_confirmation_types as $hf_key => $hf_val) { |
| 33 |
?> |
| 34 |
<option value="<?php echo esc_attr($hf_key) ?>" <?php selected($settings['confirmation_type'], $hf_key); ?>><?php echo esc_html($hf_val); ?></option> |
| 35 |
<?php |
| 36 |
} |
| 37 |
?> |
| 38 |
</select> |
| 39 |
</div> |
| 40 |
|
| 41 |
<div class="hf-form-row" data-condition-toggle="hf-form-conformation-type" data-condition-val="show_message"> |
| 42 |
<label><?php esc_html_e('Message', 'hash-form'); ?></label> |
| 43 |
<textarea name="confirmation_message"><?php echo esc_html($settings['confirmation_message']) ?></textarea> |
| 44 |
</div> |
| 45 |
|
| 46 |
<div class="hf-form-row" data-condition-toggle="hf-form-conformation-type" data-condition-val="show_page"> |
| 47 |
<label><?php esc_html_e('Show Page', 'hash-form'); ?></label> |
| 48 |
<select name="show_page_id"> |
| 49 |
<?php foreach (get_pages() as $page) { ?> |
| 50 |
<option value="<?php echo esc_attr($page->ID); ?>" <?php selected($settings['show_page_id'], $page->ID); ?>><?php echo esc_html($page->post_title); ?></option> |
| 51 |
<?php } ?> |
| 52 |
</select> |
| 53 |
</div> |
| 54 |
|
| 55 |
<div class="hf-form-row" data-condition-toggle="hf-form-conformation-type" data-condition-val="redirect_url"> |
| 56 |
<label><?php esc_html_e('Redirect URL', 'hash-form'); ?></label> |
| 57 |
<input type="text" name="redirect_url_page" value="<?php echo esc_attr($settings['redirect_url_page']) ?>" /> |
| 58 |
</div> |
| 59 |
|
| 60 |
<div class="hf-form-row"> |
| 61 |
<label><?php esc_html_e('Error Message', 'hash-form'); ?></label> |
| 62 |
<textarea name="error_message"><?php echo esc_textarea($settings['error_message']) ?></textarea> |
| 63 |
</div> |
| 64 |
</div> |