| @@ -20,10 +20,20 @@ | ||
| 20 | 20 | } |
| 21 | 21 | ?> |
| 22 | 22 | <li id="frm_delete_field_<?php echo esc_attr( $field['id'] . '-' . $opt_key ); ?>_container" data-optkey="<?php echo esc_attr( $opt_key ); ?>" class="frm_single_option <?php echo $opt_key === '000' ? 'frm_hidden frm_option_template' : ''; ?>"> |
| 23 | 23 | <?php |
| 24 | - $show_icons = empty( $field['do_not_include_icons'] ); | |
| 24 | + $show_icons = empty( $field['do_not_include_icons'] ); | |
| 25 | + $is_template = '000' === $opt_key; | |
| 25 | 26 | |
| 27 | + /** | |
| 28 | + * The add and remove buttons are identical on every option of every field, and no one looks at | |
| 29 | + * them until that field is opened, so leave them out alongside the icons. The hidden template | |
| 30 | + * row keeps a copy either way, because that is what the builder fills the real rows in from. | |
| 31 | + * | |
| 32 | + * @see addOptionControlsToField() in js/src/admin/admin.js | |
| 33 | + */ | |
| 34 | + $show_option_controls = $show_icons || $is_template; | |
| 35 | + | |
| 26 | 36 | if ( $show_icons ) { |
| 27 | 37 | FrmAppHelper::icon_by_class( 'frmfont frm_drag_icon frm-drag' ); |
| 28 | 38 | } |
| 29 | 39 | |
| @@ -33,8 +43,9 @@ | ||
| 33 | 43 | <?php endif; ?> |
| 34 | 44 | |
| 35 | 45 | <input type="text" name="field_options[options_<?php echo esc_attr( $field['id'] ); ?>][<?php echo esc_attr( $opt_key ); ?>][label]" value="<?php echo esc_attr( $opt ); ?>" class="field_<?php echo esc_attr( $field['id'] ); ?>_option <?php echo esc_attr( $field['separate_value'] ? 'frm_with_key' : '' ); ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key . '-label' ); ?>" data-frmchange="trim,updateOption,checkUniqueOpt" /> |
| 36 | 46 | |
| 47 | + <?php if ( $show_option_controls ) : ?> | |
| 37 | 48 | <a href="javascript:void(0)" class="frm_remove_tag<?php echo ! empty( $options_count ) && $options_count > 1 ? '' : ' frm_disabled'; ?>" data-fid="<?php echo esc_attr( $field['id'] ); ?>" data-removeid="frm_delete_field_<?php echo esc_attr( $field['id'] . '-' . $opt_key ); ?>_container" data-removemore="#frm_<?php echo esc_attr( $default_type . '_' . $field['id'] . '-' . $opt_key ); ?>" data-showlast="#frm_add_opt_<?php echo esc_attr( $field['id'] ); ?>"> |
| 38 | 49 | <?php FrmAppHelper::icon_by_class( 'frmfont frm_minus1_icon frm_svg15' ); ?> |
| 39 | 50 | </a> |
| 40 | 51 | |
| @@ -40,8 +51,9 @@ | ||
| 40 | 51 | |
| 41 | 52 | <a href="javascript:void(0);" data-opttype="single" class="frm_cb_button frm_add_opt frm_form_field" id="frm_add_opt_<?php echo esc_attr( $field['id'] ); ?>"> |
| 42 | 53 | <?php FrmAppHelper::icon_by_class( 'frmfont frm_plus1_icon frm_add_tag frm_svg15' ); ?> |
| 43 | 54 | </a> |
| 55 | + <?php endif; ?> | |
| 44 | 56 | |
| 45 | 57 | <span class="frm_option_key frm-with-right-icon field_<?php echo esc_attr( $field['id'] ); ?>_option_key<?php echo esc_attr( $field['separate_value'] ? '' : ' frm_hidden' ); ?>"> |
| 46 | 58 | <?php if ( in_array( $default_type, array( 'radio', 'checkbox' ), true ) ) : ?> |
| 47 | 59 | <input type="<?php echo esc_attr( $default_type ); ?>" class="frm_invisible" /> |