| 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 |
$conditional_logics = HashFormBuilder::get_show_hide_conditions($id); |
| 11 |
?> |
| 12 |
<div class="hf-form-container"> |
| 13 |
<div class="hf-form-row"> |
| 14 |
<p class="hf-section-help"> |
| 15 |
<?php esc_html_e('Show or hide a field based on what the visitor has answered elsewhere in this form. Rules are checked as they type, and again when the form is submitted.', 'hash-form'); ?> |
| 16 |
</p> |
| 17 |
|
| 18 |
<div class="hf-condition-list<?php echo empty($conditional_logics) ? ' hf-condition-list-empty' : ''; ?>"> |
| 19 |
<div class="hf-condition-empty"> |
| 20 |
<span class="mdi mdi-directions-fork" aria-hidden="true"></span> |
| 21 |
<p class="hf-condition-empty-title"><?php esc_html_e('No rules yet', 'hash-form'); ?></p> |
| 22 |
<p class="hf-condition-empty-text"><?php esc_html_e('Every field is shown to everyone until you add one.', 'hash-form'); ?></p> |
| 23 |
</div> |
| 24 |
|
| 25 |
<div class="hf-condition-rows"> |
| 26 |
<?php |
| 27 |
foreach ($conditional_logics as $row) { |
| 28 |
HashFormBuilder::condition_row_html($fields, $row); |
| 29 |
} |
| 30 |
?> |
| 31 |
</div> |
| 32 |
</div> |
| 33 |
|
| 34 |
<button type="button" class="hf-add-more-condition"> |
| 35 |
<span class="mdi mdi-plus" aria-hidden="true"></span> |
| 36 |
<?php esc_html_e('Add Condition', 'hash-form'); ?> |
| 37 |
</button> |
| 38 |
</div> |
| 39 |
</div> |
| 40 |
|