| 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 |
|
| 11 |
<div id="hf-editor-wrap" class="<?php echo ($has_fields ? 'hf-editor-has-fields' : ''); ?>"> |
| 12 |
<ul id="hf-editor-fields" class="hf-editor-sorting inside"> |
| 13 |
<?php |
| 14 |
if (!empty($vars['fields'])) { |
| 15 |
$grid_helper = new HashFormGridHelper(); |
| 16 |
$vars['count'] = 0; |
| 17 |
foreach ($vars['fields'] as $field) { |
| 18 |
$vars['count']++; |
| 19 |
$grid_helper->set_field($field); |
| 20 |
$grid_helper->maybe_begin_field_wrapper(); |
| 21 |
$field_obj = HashFormFields::get_field_class($field['type'], $field); |
| 22 |
$field_obj->load_single_field(); |
| 23 |
$grid_helper->sync_list_size(); |
| 24 |
unset($field); |
| 25 |
} |
| 26 |
$grid_helper->force_close_field_wrapper(); |
| 27 |
unset($grid_helper); |
| 28 |
} |
| 29 |
?> |
| 30 |
</ul> |
| 31 |
|
| 32 |
<div class="hf-editor-submit-button-wrap hf-submit-btn-align-<?php echo (isset($form->options['submit_btn_alignment']) ? esc_attr($form->options['submit_btn_alignment']) : 'left'); ?>"> |
| 33 |
<button id="hf-editor-submit-button" class="hf-editor-submit-button" disabled="disabled"> |
| 34 |
<?php echo (isset($form->options['submit_value']) ? esc_html($form->options['submit_value']) : esc_html__('Submit', 'hash-form')); ?> |
| 35 |
</button> |
| 36 |
</div> |
| 37 |
|
| 38 |
<div class="hf-no-fields"> |
| 39 |
<span> |
| 40 |
<h3><?php esc_html_e('Add Fields Here', 'hash-form'); ?></h3> |
| 41 |
<p><?php esc_html_e('Drag a field from the sidebar to add it to your form', 'hash-form'); ?></p> |
| 42 |
</span> |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
|
| 46 |
<div id="hf-bulk-edit-modal"> |
| 47 |
<div class="postbox"> |
| 48 |
<div class="hf-bulk-edit-modal-header"> |
| 49 |
<h2> |
| 50 |
<?php esc_html_e('Bulk Edit Options', 'hash-form'); ?> |
| 51 |
</h2> |
| 52 |
<?php // A button, not an anchor: an <a> with no href cannot be reached by keyboard. ?> |
| 53 |
<button type="button" class="dismiss" title="<?php esc_attr_e('Close', 'hash-form'); ?>"> |
| 54 |
<span class="mdi mdi-window-close" aria-hidden="true"></span> |
| 55 |
<span class="screen-reader-text"><?php esc_html_e('Close', 'hash-form'); ?></span> |
| 56 |
</button> |
| 57 |
</div> |
| 58 |
|
| 59 |
<div class="hf-bulk-edit-body hf-editor-grid-container"> |
| 60 |
<div class="hf-grid-8 hf-bulk-edit-content"> |
| 61 |
<label class="hf-bulk-edit-label" for="hf-bulk-options"> |
| 62 |
<?php esc_html_e('One option per line', 'hash-form'); ?> |
| 63 |
</label> |
| 64 |
|
| 65 |
<textarea name="hashform_bulk_options" id="hf-bulk-options" spellcheck="false"></textarea> |
| 66 |
|
| 67 |
<p class="hf-bulk-edit-help"> |
| 68 |
<?php |
| 69 |
printf( |
| 70 |
/* translators: %s: the label|value example, shown in code formatting. */ |
| 71 |
esc_html__('With separate values switched on, write each line as %s.', 'hash-form'), |
| 72 |
'<code>' . esc_html__('Label|value', 'hash-form') . '</code>' |
| 73 |
); |
| 74 |
?> |
| 75 |
</p> |
| 76 |
|
| 77 |
<input type="hidden" value="" id="bulk-field-id" /> |
| 78 |
<input type="hidden" value="" id="bulk-option-type" /> |
| 79 |
</div> |
| 80 |
<div class="hf-grid-4 hf-bulk-edit-sidebar"> |
| 81 |
<h3> |
| 82 |
<?php esc_html_e('Insert Presets', 'hash-form'); ?> |
| 83 |
</h3> |
| 84 |
<p class="hf-bulk-edit-help"> |
| 85 |
<?php esc_html_e('Replaces whatever is in the box.', 'hash-form'); ?> |
| 86 |
</p> |
| 87 |
<ul class="hf-default-opts hf-scroll"> |
| 88 |
<?php |
| 89 |
$preset_options = HashFormHelper::get_options_presets(); |
| 90 |
foreach ($preset_options as $class => $option) { |
| 91 |
?> |
| 92 |
<li class="<?php echo esc_attr($class); ?>"> |
| 93 |
<a href="#" class="hf-insert-preset" data-opts="<?php echo esc_attr(wp_json_encode($option['options'])); ?>"> |
| 94 |
<?php echo esc_html($option['label']); ?> |
| 95 |
<span class="hf-preset-count"><?php echo esc_html(number_format_i18n(count($option['options']))); ?></span> |
| 96 |
</a> |
| 97 |
</li> |
| 98 |
<?php } ?> |
| 99 |
</ul> |
| 100 |
</div> |
| 101 |
</div> |
| 102 |
|
| 103 |
<div class="hf-bulk-edit-modal-footer"> |
| 104 |
<button type="button" class="button dismiss"> |
| 105 |
<?php esc_html_e('Cancel', 'hash-form'); ?> |
| 106 |
</button> |
| 107 |
<button type="button" class="button button-primary" id="hf-update-bulk-options"> |
| 108 |
<?php esc_html_e('Update Options', 'hash-form'); ?> |
| 109 |
</button> |
| 110 |
</div> |
| 111 |
</div> |
| 112 |
</div> |