| @@ -2,174 +2,248 @@ | ||
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | ?> |
| 6 | -<div class="frm-right-panel"> | |
| 6 | +<div class="frm-right-panel frm-settings-panel frm-scrollbar-wrapper"> | |
| 7 | 7 | <div class="frm_field_list"> |
| 8 | - <ul id="frm-nav-tabs" class="frm-nav-tabs"> | |
| 9 | - <li class="frm-tabs"> | |
| 10 | - <a href="#frm-insert-fields" id="frm_insert_fields_tab"> | |
| 11 | - <?php esc_html_e( 'Add Fields', 'formidable' ); ?> | |
| 12 | - </a> | |
| 13 | - </li> | |
| 14 | - <li class="hide-if-no-js"> | |
| 15 | - <a href="#frm-options-panel" id="frm-options-panel-tab"> | |
| 16 | - <?php esc_html_e( 'Field Options', 'formidable' ); ?> | |
| 17 | - </a> | |
| 18 | - </li> | |
| 19 | - <?php do_action( 'frm_extra_form_instruction_tabs' ); ?> | |
| 20 | - </ul> | |
| 8 | + <div class="frm-style-tabs-wrapper"> | |
| 9 | + <div class="frm-tabs-delimiter"> | |
| 10 | + <span class="frm-tabs-active-underline"></span> | |
| 11 | + </div> | |
| 21 | 12 | |
| 22 | - <div id="frm-insert-fields" class="tabs-panel"> | |
| 23 | - <?php | |
| 24 | - FrmAppHelper::show_search_box( | |
| 25 | - array( | |
| 26 | - 'input_id' => 'field-list', | |
| 27 | - 'placeholder' => __( 'Search Fields', 'formidable' ), | |
| 28 | - 'tosearch' => 'frmbutton', | |
| 29 | - ) | |
| 30 | - ); | |
| 31 | - ?> | |
| 32 | - <ul class="field_type_list frm_grid_container"> | |
| 33 | - <?php | |
| 34 | - foreach ( $frm_field_selection as $field_key => $field_type ) { | |
| 35 | - $field_label = FrmFormsHelper::get_field_link_name( $field_type ); | |
| 36 | - ?> | |
| 37 | - <li class="frmbutton frm6 <?php echo esc_attr( ' frm_t' . $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>"> | |
| 38 | - <a href="#" class="frm_add_field frm_animate_bg" title="<?php echo esc_html( $field_label ); ?>"> | |
| 39 | - <?php FrmAppHelper::icon_by_class( FrmFormsHelper::get_field_link_icon( $field_type ) ); ?> | |
| 40 | - <span><?php echo esc_html( $field_label ); ?></span> | |
| 13 | + <div class="frm-tabs-navs"> | |
| 14 | + <ul class="frm-flex-box"> | |
| 15 | + <li class="frm-active"> | |
| 16 | + <a href="#frm-insert-fields" id="frm_insert_fields_tab"> | |
| 17 | + <?php esc_html_e( 'Add Fields', 'formidable' ); ?> | |
| 41 | 18 | </a> |
| 42 | 19 | </li> |
| 43 | - <?php | |
| 44 | - unset( $field_key, $field_type ); | |
| 45 | - } | |
| 46 | - ?> | |
| 47 | - </ul> | |
| 48 | - <div class="clear"></div> | |
| 49 | - <?php FrmTipsHelper::pro_tip( 'get_builder_tip' ); ?> | |
| 50 | - <h3 class="frm-with-line"> | |
| 51 | - <span><?php esc_html_e( 'Advanced Fields', 'formidable' ); ?></span> | |
| 52 | - </h3> | |
| 53 | - <ul class="field_type_list frm_grid_container"> | |
| 54 | -<?php | |
| 20 | + <li class="hide-if-no-js"> | |
| 21 | + <a href="#frm-options-panel" id="frm-options-panel-tab"> | |
| 22 | + <?php esc_html_e( 'Field Options', 'formidable' ); ?> | |
| 23 | + </a> | |
| 24 | + </li> | |
| 25 | + <?php do_action( 'frm_extra_form_instruction_tabs' ); ?> | |
| 26 | + </ul> | |
| 27 | + </div> | |
| 55 | 28 | |
| 56 | -$no_allow_class = apply_filters( 'frm_noallow_class', 'frm_noallow' ); | |
| 57 | -if ( $no_allow_class === 'frm_noallow' ) { | |
| 58 | - $no_allow_class .= ' frm_show_upgrade'; | |
| 59 | -} | |
| 29 | + <div class="frm-tabs-container"> | |
| 30 | + <div class="frm-tabs-slide-track frm-flex-box"> | |
| 31 | + <div class="frm-active"> | |
| 32 | + <div id="frm-insert-fields" class="tabs-panel"> | |
| 33 | + <?php | |
| 34 | + FrmAppHelper::show_search_box( | |
| 35 | + array( | |
| 36 | + 'input_id' => 'field-list', | |
| 37 | + 'placeholder' => __( 'Search Fields', 'formidable' ), | |
| 38 | + 'tosearch' => 'frmbutton', | |
| 39 | + ) | |
| 40 | + ); | |
| 41 | + ?> | |
| 42 | + <ul class="field_type_list frm_grid_container"> | |
| 43 | + <?php | |
| 44 | + $field_sections = array(); | |
| 60 | 45 | |
| 61 | -$pro_fields = FrmField::pro_field_selection(); | |
| 62 | -$field_sections = array(); | |
| 63 | -foreach ( $pro_fields as $field_key => $field_type ) { | |
| 46 | + foreach ( $frm_field_selection as $field_key => $field_type ) { | |
| 47 | + if ( ! is_array( $field_type ) ) { | |
| 48 | + continue; | |
| 49 | + } | |
| 64 | 50 | |
| 65 | - if ( isset( $field_type['section'] ) ) { | |
| 66 | - if ( ! isset( $field_sections[ $field_type['section'] ] ) ) { | |
| 67 | - $field_sections[ $field_type['section'] ] = array(); | |
| 68 | - } | |
| 69 | - $field_sections[ $field_type['section'] ][ $field_key ] = $field_type; | |
| 70 | - continue; | |
| 71 | - } | |
| 51 | + // Skip showing field if it's in a section. | |
| 52 | + if ( isset( $field_type['section'] ) ) { | |
| 53 | + if ( ! isset( $field_sections[ $field_type['section'] ] ) ) { | |
| 54 | + $field_sections[ $field_type['section'] ] = array(); | |
| 55 | + } | |
| 72 | 56 | |
| 73 | - if ( is_array( $field_type ) && isset( $field_type['switch_from'] ) ) { | |
| 74 | - continue; | |
| 75 | - } | |
| 57 | + // Mark this field as available when showing in later sections. | |
| 58 | + $field_type['is_available'] = true; | |
| 76 | 59 | |
| 77 | - if ( is_array( $field_type ) && isset( $field_type['types'] ) ) { | |
| 78 | - _deprecated_argument( 'Field with sub types', '4.0' ); | |
| 79 | - $field_label = $field_type['name']; | |
| 60 | + $field_sections[ $field_type['section'] ][ $field_key ] = $field_type; | |
| 61 | + continue; | |
| 62 | + } | |
| 80 | 63 | |
| 81 | - ?> | |
| 82 | - <li class="frmbutton frm6 <?php echo esc_attr( $no_allow_class . ' frm_t' . $field_key ); ?> dropdown" id="<?php echo esc_attr( $field_key ); ?>"> | |
| 83 | - <a href="#" id="frm-<?php echo esc_attr( $field_key ); ?>Drop" class="frm-dropdown-toggle" data-toggle="dropdown" title="<?php echo esc_html( $field_label ); ?>"> | |
| 84 | - <?php FrmAppHelper::icon_by_class( FrmFormsHelper::get_field_link_icon( $field_type ) ); ?> | |
| 85 | - <span><?php echo esc_html( $field_label ); ?> <b class="caret"></b></span> | |
| 86 | - </a> | |
| 64 | + $field_type['key'] = $field_key; | |
| 65 | + FrmFieldsHelper::show_add_field_link( $field_type ); | |
| 66 | + unset( $field_key, $field_type ); | |
| 67 | + }//end foreach | |
| 68 | + ?> | |
| 69 | + </ul> | |
| 70 | + <div class="clear"></div> | |
| 71 | + <?php | |
| 72 | + FrmTipsHelper::pro_tip( 'get_builder_tip' ); | |
| 87 | 73 | |
| 88 | - <ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-<?php echo esc_attr( $field_key ); ?>Drop"> | |
| 89 | - <?php foreach ( $field_type['types'] as $k => $type ) { ?> | |
| 90 | - <li class="frm_t<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>|<?php echo esc_attr( $k ); ?>"> | |
| 91 | - <?php echo FrmAppHelper::kses( apply_filters( 'frmpro_field_links', $type, $id, $field_key . '|' . $k ), array( 'a', 'i', 'span' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 92 | - </li> | |
| 93 | - <?php | |
| 94 | - unset( $k, $type ); | |
| 95 | - } | |
| 96 | - ?> | |
| 97 | - </ul> | |
| 98 | - </li> | |
| 99 | - <?php | |
| 100 | - } else { | |
| 101 | - FrmFieldsHelper::show_add_field_buttons( compact( 'field_key', 'field_type', 'id', 'no_allow_class' ) ); | |
| 102 | - } | |
| 74 | + $no_allow_class = apply_filters( 'frm_noallow_class', 'frm_noallow' ); | |
| 103 | 75 | |
| 104 | - unset( $field_key, $field_type, $field_label ); | |
| 105 | -} | |
| 106 | -?> | |
| 107 | - </ul> | |
| 108 | - <div class="clear"></div> | |
| 76 | + if ( $no_allow_class === 'frm_noallow' ) { | |
| 77 | + $no_allow_class .= ' frm_show_upgrade'; | |
| 78 | + } | |
| 109 | 79 | |
| 110 | - <?php foreach ( $field_sections as $section => $section_fields ) { ?> | |
| 111 | - <h3 class="frm-with-line"> | |
| 112 | - <span><?php esc_html_e( 'Pricing Fields', 'formidable' ); ?></span> | |
| 113 | - </h3> | |
| 114 | - <ul class="field_type_list frm_grid_container"> | |
| 80 | + $pro_fields = FrmField::pro_field_selection(); | |
| 81 | + | |
| 82 | + FrmField::remove_moved_field_types_from_pro( $pro_fields ); | |
| 83 | + | |
| 84 | + foreach ( $pro_fields as $field_key => $field_type ) { | |
| 85 | + if ( ! is_array( $field_type ) || ! isset( $field_type['section'] ) ) { | |
| 86 | + continue; | |
| 87 | + } | |
| 88 | + | |
| 89 | + if ( ! isset( $field_sections[ $field_type['section'] ] ) ) { | |
| 90 | + $field_sections[ $field_type['section'] ] = array(); | |
| 91 | + } | |
| 92 | + $field_sections[ $field_type['section'] ][ $field_key ] = $field_type; | |
| 93 | + } | |
| 94 | + | |
| 95 | + $section_labels = FrmField::field_section_labels(); | |
| 96 | + | |
| 97 | + foreach ( $field_sections as $section => $section_fields ) { | |
| 98 | + ?> | |
| 99 | + <h3 class="frm-with-line"> | |
| 100 | + <span><?php echo esc_html( $section_labels[ $section ] ?? ucwords( $section ) ); ?></span> | |
| 101 | + <span style="padding-left: 0;"> | |
| 102 | + <?php | |
| 103 | + if ( ! FrmAppHelper::pro_is_installed() ) { | |
| 104 | + FrmAppHelper::show_pill_text(); | |
| 105 | + } | |
| 106 | + ?> | |
| 107 | + </span> | |
| 108 | + </h3> | |
| 109 | + <ul class="field_type_list frm_grid_container"> | |
| 110 | + <?php | |
| 111 | + foreach ( $section_fields as $field_key => $field_type ) { | |
| 112 | + if ( ! empty( $field_type['is_available'] ) ) { | |
| 113 | + $field_type['key'] = $field_key; | |
| 114 | + FrmFieldsHelper::show_add_field_link( $field_type ); | |
| 115 | + } else { | |
| 116 | + FrmFieldsHelper::show_add_field_buttons( compact( 'field_key', 'field_type', 'id', 'no_allow_class' ) ); | |
| 117 | + } | |
| 118 | + unset( $field_key, $field_type ); | |
| 119 | + } | |
| 120 | + ?> | |
| 121 | + </ul> | |
| 122 | + <div class="clear"></div> | |
| 123 | + <?php | |
| 124 | + }//end foreach | |
| 125 | + ?> | |
| 126 | + | |
| 127 | + <h3 class="frm-with-line"> | |
| 128 | + <span><?php esc_html_e( 'Advanced Fields', 'formidable' ); ?></span> | |
| 129 | + </h3> | |
| 130 | + <ul class="field_type_list frm_grid_container"> | |
| 131 | + <?php | |
| 132 | + foreach ( $pro_fields as $field_key => $field_type ) { | |
| 133 | + if ( isset( $field_type['section'] ) ) { | |
| 134 | + continue; | |
| 135 | + } | |
| 136 | + | |
| 137 | + if ( is_array( $field_type ) && isset( $field_type['switch_from'] ) ) { | |
| 138 | + continue; | |
| 139 | + } | |
| 140 | + | |
| 141 | + if ( is_array( $field_type ) && isset( $field_type['types'] ) ) { | |
| 142 | + _deprecated_argument( 'Field with sub types', '4.0' ); | |
| 143 | + $field_label = $field_type['name']; | |
| 144 | + ?> | |
| 145 | + <li class="frmbutton frm6 <?php echo esc_attr( $no_allow_class . ' frm_t' . $field_key ); ?> dropdown" id="<?php echo esc_attr( $field_key ); ?>"> | |
| 146 | + <a href="#" id="frm-<?php echo esc_attr( $field_key ); ?>Drop" class="frm-dropdown-toggle" data-toggle="dropdown" title="<?php echo esc_attr( $field_label ); ?>" role="button" aria-label="<?php echo esc_attr( $field_label ); ?>"> | |
| 147 | + <?php FrmAppHelper::icon_by_class( FrmFormsHelper::get_field_link_icon( $field_type ) ); ?> | |
| 148 | + <span><?php echo esc_html( $field_label ); ?> <b class="caret"></b></span> | |
| 149 | + </a> | |
| 150 | + | |
| 151 | + <ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-<?php echo esc_attr( $field_key ); ?>Drop"> | |
| 152 | + <?php foreach ( $field_type['types'] as $k => $type ) { ?> | |
| 153 | + <li class="frm_t<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>|<?php echo esc_attr( $k ); ?>"> | |
| 154 | + <?php FrmAppHelper::kses_echo( apply_filters( 'frmpro_field_links', $type, $id, $field_key . '|' . $k ), array( 'a', 'i', 'span' ) ); ?> | |
| 155 | + </li> | |
| 156 | + <?php | |
| 157 | + unset( $k, $type ); | |
| 158 | + } | |
| 159 | + ?> | |
| 160 | + </ul> | |
| 161 | + </li> | |
| 162 | + <?php | |
| 163 | + } else { | |
| 164 | + FrmFieldsHelper::show_add_field_buttons( compact( 'field_key', 'field_type', 'id', 'no_allow_class' ) ); | |
| 165 | + }//end if | |
| 166 | + | |
| 167 | + unset( $field_key, $field_type, $field_label ); | |
| 168 | + }//end foreach | |
| 169 | + ?> | |
| 170 | + </ul> | |
| 171 | + <div class="clear"></div> | |
| 172 | + </div> | |
| 173 | + <?php do_action( 'frm_extra_form_instructions' ); ?> | |
| 174 | + </div> | |
| 175 | + | |
| 176 | + <div> | |
| 177 | + <div id="frm-options-panel" class="tabs-panel"> | |
| 178 | + <div class="frm-single-settings"> | |
| 179 | + <div class="frm-embed-field-placeholder"> | |
| 180 | + <div class="frm-embed-message"> | |
| 181 | + <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/page-skeleton/empty-state.svg' ); ?>" alt="<?php esc_attr_e( 'Empty State', 'formidable' ); ?>" /> | |
| 182 | + <span><?php esc_html_e( 'Select a field to see the options', 'formidable' ); ?></span> | |
| 183 | + <button type="button" id="frm-form-add-field" class="frm-button-secondary frm-cursor-pointer frm-mt-xs"> | |
| 184 | + <?php FrmAppHelper::icon_by_class( 'frmfont frm_plus_icon', array( 'aria-label' => __( 'Add Fields', 'formidable' ) ) ); ?> | |
| 185 | + <span><?php esc_html_e( 'Add Fields', 'formidable' ); ?></span> | |
| 186 | + </button> | |
| 187 | + </div> | |
| 188 | + </div> | |
| 189 | + </div> | |
| 190 | + <form method="post" id="new_fields"> | |
| 191 | + <input type="hidden" name="frm_action" value="update" /> | |
| 192 | + <input type="hidden" name="action" value="update" /> | |
| 193 | + <input type="hidden" name="id" id="form_id" value="<?php echo esc_attr( $values['id'] ); ?>" /> | |
| 194 | + <input type="hidden" name="draft_fields" id="draft_fields" value="<?php echo esc_attr( implode( ',', FrmFieldsHelper::get_all_draft_field_ids( $values['id'] ) ) ); ?>" /> | |
| 195 | + <?php wp_nonce_field( 'frm_save_form_nonce', 'frm_save_form' ); ?> | |
| 196 | + <input type="hidden" id="frm-end-form-marker" name="frm_end" value="1" /> | |
| 197 | + | |
| 198 | + <?php | |
| 199 | + FrmFieldsHelper::inline_modal( | |
| 200 | + array( | |
| 201 | + 'callback' => array( 'FrmFieldsHelper', 'smart_values' ), | |
| 202 | + 'id' => 'frm-smart-values-box', | |
| 203 | + 'dismiss-icon' => false, | |
| 204 | + ) | |
| 205 | + ); | |
| 206 | + | |
| 207 | + FrmFieldsHelper::inline_modal( | |
| 208 | + array( | |
| 209 | + 'callback' => array( 'FrmFieldsHelper', 'layout_classes' ), | |
| 210 | + 'id' => 'frm-layout-classes-box', | |
| 211 | + 'dismiss-icon' => false, | |
| 212 | + ) | |
| 213 | + ); | |
| 214 | + | |
| 215 | + FrmFieldsHelper::inline_modal( | |
| 216 | + array( | |
| 217 | + 'callback' => array( 'FrmFieldsHelper', 'input_mask' ), | |
| 218 | + 'id' => 'frm-input-mask-box', | |
| 219 | + 'dismiss-icon' => false, | |
| 220 | + ) | |
| 221 | + ); | |
| 222 | + ?> | |
| 223 | + </form> | |
| 224 | + </div> | |
| 225 | + </div> | |
| 115 | 226 | <?php |
| 116 | - foreach ( $section_fields as $field_key => $field_type ) { | |
| 117 | - FrmFieldsHelper::show_add_field_buttons( compact( 'field_key', 'field_type', 'id', 'no_allow_class' ) ); | |
| 118 | - unset( $field_key, $field_type ); | |
| 227 | + if ( isset( $form ) ) { | |
| 228 | + /** | |
| 229 | + * Hook in so people can include additional tab content. | |
| 230 | + * Used along with frm_extra_form_instruction_tabs which is used to | |
| 231 | + * include the tabs. | |
| 232 | + * | |
| 233 | + * @since 6.31 | |
| 234 | + * | |
| 235 | + * @param stdClass $form The form object. | |
| 236 | + */ | |
| 237 | + do_action( 'frm_extra_form_instruction_tabs_content', $form ); | |
| 119 | 238 | } |
| 120 | 239 | ?> |
| 121 | - </ul> | |
| 122 | - <div class="clear"></div> | |
| 123 | - <?php } ?> | |
| 124 | - </div> | |
| 125 | - <?php do_action( 'frm_extra_form_instructions' ); ?> | |
| 126 | - | |
| 127 | - <div id="frm-options-panel" class="frm-p-6 tabs-panel frm_hidden"> | |
| 128 | - <div class="frm-single-settings"> | |
| 129 | - <div class="frm-embed-field-placeholder"> | |
| 130 | - <div class="frm-embed-message"> | |
| 131 | - <?php esc_html_e( 'Select a field to see the options', 'formidable' ); ?> | |
| 132 | - </div> | |
| 133 | 240 | </div> |
| 134 | 241 | </div> |
| 135 | - <form method="post" id="new_fields"> | |
| 136 | - <input type="hidden" name="frm_action" value="update" /> | |
| 137 | - <input type="hidden" name="action" value="update" /> | |
| 138 | - <input type="hidden" name="id" id="form_id" value="<?php echo esc_attr( $values['id'] ); ?>" /> | |
| 139 | - <?php wp_nonce_field( 'frm_save_form_nonce', 'frm_save_form' ); ?> | |
| 140 | - <input type="hidden" id="frm-end-form-marker" name="frm_end" value="1" /> | |
| 141 | - | |
| 142 | - <?php | |
| 143 | - FrmFieldsHelper::inline_modal( | |
| 144 | - array( | |
| 145 | - 'title' => __( 'Smart Default Values', 'formidable' ), | |
| 146 | - 'callback' => array( 'FrmFieldsHelper', 'smart_values' ), | |
| 147 | - 'id' => 'frm-smart-values-box', | |
| 148 | - ) | |
| 149 | - ); | |
| 150 | - | |
| 151 | - FrmFieldsHelper::inline_modal( | |
| 152 | - array( | |
| 153 | - 'title' => __( 'Add Layout Classes', 'formidable' ), | |
| 154 | - 'callback' => array( 'FrmFieldsHelper', 'layout_classes' ), | |
| 155 | - 'id' => 'frm-layout-classes-box', | |
| 156 | - ) | |
| 157 | - ); | |
| 158 | - | |
| 159 | - FrmFieldsHelper::inline_modal( | |
| 160 | - array( | |
| 161 | - 'title' => __( 'Input Mask Format', 'formidable' ), | |
| 162 | - 'callback' => array( 'FrmFieldsHelper', 'input_mask' ), | |
| 163 | - 'id' => 'frm-input-mask-box', | |
| 164 | - ) | |
| 165 | - ); | |
| 166 | - ?> | |
| 167 | - </form> | |
| 168 | 242 | </div> |
| 169 | 243 | </div> |
| 170 | 244 | |
| 171 | 245 | <form method="post" id="frm_js_build_form"> |
| 172 | 246 | <input type="hidden" id="frm_compact_fields" name="frm_compact_fields" value="" /> |
| 173 | - <button class="frm_submit_form frm_submit_<?php echo esc_attr( ( isset( $values['ajax_load'] ) && $values['ajax_load'] ) ? '' : 'no_' ); ?>ajax frm_hidden frm_button_submit" type="button" id="frm_submit_side"><?php esc_html_e( 'Update', 'formidable' ); ?></button> | |
| 247 | + <button class="frm_submit_form frm_submit_<?php echo esc_attr( ! empty( $values['ajax_load'] ) ? '' : 'no_' ); ?>ajax frm_hidden frm_button_submit" type="button" id="frm_submit_side"><?php esc_html_e( 'Update', 'formidable' ); ?></button> | |
| 174 | 248 | </form> |
| 175 | 249 | </div> |