dialogs
5 years ago
elements
4 years ago
tab-appearance
4 years ago
tab-behaviour
4 years ago
tab-content
4 years ago
tab-display-options
5 years ago
tab-emails
4 years ago
tab-visibility
4 years ago
templates
4 years ago
navigation.php
4 years ago
status-bar.php
5 years ago
wizard.php
4 years ago
wizard.php
264 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Main wrapper for wizards. |
| 4 | * |
| 5 | * @uses ../../dialogs/migrate-dismiss-confirmation.php |
| 6 | * @uses ../../global/sui-components/sui-footer.php |
| 7 | * @uses ../dialogs/ |
| 8 | * @uses ../templates/ |
| 9 | * @uses ../navigation.php |
| 10 | * @uses ../status-bar.php |
| 11 | * @uses ../dialogs/modal-preview.php |
| 12 | * |
| 13 | * @package Hustle |
| 14 | * @since 4.0.0 |
| 15 | */ |
| 16 | |
| 17 | $docs_section = Hustle_Module_Model::SOCIAL_SHARING_MODULE !== $module_type ? 'content' : 'social-sharing'; |
| 18 | ?> |
| 19 | |
| 20 | <div class="sui-header hui-header-with-settings"> |
| 21 | |
| 22 | <div class="hui-header-title"> |
| 23 | |
| 24 | <?php /* translators: module type capitalized and in singular */ ?> |
| 25 | <h1 class="sui-header-title"><?php printf( esc_html__( 'Edit %s', 'hustle' ), esc_html( $capitalize_singular ) ); ?></h1> |
| 26 | |
| 27 | <?php $this->render( 'admin/commons/view-documentation', array( 'docs_section' => $docs_section ) ); ?> |
| 28 | |
| 29 | </div> |
| 30 | |
| 31 | <div class="hui-header-settings"> |
| 32 | |
| 33 | <div class="sui-actions-left"> |
| 34 | |
| 35 | <div id="hustle-module-name-wrapper" class="sui-form-field"> |
| 36 | |
| 37 | <label for="hustle-module-name" id="hustle-module-name-label" class="sui-screen-reader-text"><?php esc_html_e( 'Name your form', 'hustle' ); ?></label> |
| 38 | |
| 39 | <input |
| 40 | type="text" |
| 41 | name="module_name" |
| 42 | value="<?php echo htmlspecialchars( $module_name, ENT_QUOTES, 'UTF-8' ); ?>" |
| 43 | placeholder="<?php esc_html_e( 'E.g. Newsletter', 'hustle' ); ?>" |
| 44 | id="hustle-module-name" |
| 45 | class="sui-form-control" |
| 46 | data-attribute="module_name" |
| 47 | aria-labelledby="hustle-module-name-label" |
| 48 | aria-describedby="hustle-module-name-message" |
| 49 | /> |
| 50 | |
| 51 | <p role="alert" id="hustle-module-name-error" class="sui-error-message" style="display: none; margin-bottom: 0px;" data-error-message="<?php esc_html_e( 'This field is required.', 'hustle' ); ?>"></p> |
| 52 | |
| 53 | </div> |
| 54 | |
| 55 | <?php // Dropdown list. ?> |
| 56 | <div id="hustle-module-more-options" class="sui-dropdown sui-accordion-item-action"> |
| 57 | |
| 58 | <?php |
| 59 | $this->render( |
| 60 | 'admin/commons/sui-listing/elements/actions', |
| 61 | array( |
| 62 | 'edit_page' => true, |
| 63 | 'module' => $module, |
| 64 | 'smallcaps_singular' => $smallcaps_singular, |
| 65 | 'capitalize_singular' => $capitalize_singular, |
| 66 | ) |
| 67 | ); |
| 68 | ?> |
| 69 | |
| 70 | </div> |
| 71 | |
| 72 | <?php |
| 73 | // Create button. |
| 74 | $args = array( |
| 75 | 'page' => Hustle_Data::get_listing_page_by_module_type( $module->module_type ), |
| 76 | 'create-module' => 'true', |
| 77 | ); |
| 78 | |
| 79 | $tooltip = sprintf( __( 'Create New %s', 'hustle' ), $capitalize_singular ); |
| 80 | ?> |
| 81 | <a |
| 82 | href="<?php echo esc_url( add_query_arg( $args, 'admin.php' ) ); ?>" |
| 83 | class="sui-button-icon sui-tooltip sui-tooltip-bottom" |
| 84 | data-tooltip="<?php echo esc_attr( $tooltip ); ?>" |
| 85 | > |
| 86 | <span class="sui-icon-plus sui-md" aria-hidden="true"></span> |
| 87 | </a> |
| 88 | |
| 89 | </div> |
| 90 | |
| 91 | <?php $this->render( 'admin/commons/view-documentation', array( 'docs_section' => $docs_section ) ); ?> |
| 92 | |
| 93 | </div> |
| 94 | |
| 95 | </div> |
| 96 | |
| 97 | <div id="hustle-floating-notifications-wrapper" class="sui-floating-notices"></div> |
| 98 | |
| 99 | <div id="<?php echo esc_attr( $page_id ); ?>" class="sui-row-with-sidenav" data-nonce="<?php echo esc_attr( wp_create_nonce( 'hustle_save_module_wizard' ) ); ?>" data-id="<?php echo $module_id ? esc_attr( $module_id ) : '-1'; ?>"> |
| 100 | |
| 101 | <?php |
| 102 | // ELEMENT: Side Navigation. |
| 103 | $this->render( |
| 104 | 'admin/commons/sui-wizard/navigation', |
| 105 | array( |
| 106 | 'is_optin' => isset( $module_mode ) ? $module_mode : false, |
| 107 | 'section' => $page_tab, |
| 108 | 'wizard_tabs' => $wizard_tabs, |
| 109 | 'module_name' => $module_name, |
| 110 | 'module_type' => $module_type, |
| 111 | 'module' => $module, |
| 112 | 'smallcaps_singular' => $smallcaps_singular, |
| 113 | 'capitalize_singular' => $capitalize_singular, |
| 114 | ) |
| 115 | ); |
| 116 | ?> |
| 117 | |
| 118 | <div class="hustle-wizard-main-view"> |
| 119 | |
| 120 | <?php |
| 121 | // ELEMENT: Status Bar. |
| 122 | $this->render( |
| 123 | 'admin/commons/sui-wizard/status-bar', |
| 124 | array( |
| 125 | 'is_active' => $module_status, |
| 126 | 'module_type' => $module_type, |
| 127 | ) |
| 128 | ); |
| 129 | ?> |
| 130 | |
| 131 | <?php |
| 132 | foreach ( $wizard_tabs as $option ) { |
| 133 | |
| 134 | $option_array = array(); |
| 135 | |
| 136 | if ( isset( $option['support'] ) ) { |
| 137 | $option_array = $option['support']; |
| 138 | } |
| 139 | |
| 140 | if ( isset( $option['is_optin'] ) ) { |
| 141 | |
| 142 | if ( $module_mode ) : |
| 143 | |
| 144 | $this->render( |
| 145 | $option['template'], |
| 146 | $option_array |
| 147 | ); |
| 148 | |
| 149 | endif; |
| 150 | |
| 151 | } else { |
| 152 | |
| 153 | $this->render( |
| 154 | $option['template'], |
| 155 | $option_array |
| 156 | ); |
| 157 | } |
| 158 | } |
| 159 | ?> |
| 160 | |
| 161 | </div> |
| 162 | |
| 163 | </div> |
| 164 | |
| 165 | <?php $this->render( 'admin/global/sui-components/sui-footer' ); ?> |
| 166 | |
| 167 | <?php if ( isset( $module_mode ) && $module_mode ) : ?> |
| 168 | |
| 169 | <?php |
| 170 | // DIALOG: Integrations. |
| 171 | $this->render( |
| 172 | 'admin/dialogs/modal-integration', |
| 173 | array( 'module_type' => $module_type ) |
| 174 | ); |
| 175 | |
| 176 | // DIALOG: Optin Fields. |
| 177 | $this->render( |
| 178 | 'admin/commons/sui-wizard/dialogs/optin-fields', |
| 179 | array( |
| 180 | 'form_elements' => $form_elements, |
| 181 | ) |
| 182 | ); |
| 183 | |
| 184 | // DIALOG: Edit Field. |
| 185 | $this->render( |
| 186 | 'admin/commons/sui-wizard/dialogs/edit-field', |
| 187 | array( |
| 188 | 'available_recaptchas' => Hustle_Settings_Admin::get_available_recaptcha_versions(), |
| 189 | ) |
| 190 | ); |
| 191 | |
| 192 | // DIALOG: Final Field. |
| 193 | $this->render( 'admin/dialogs/final-integration-form-delete', array() ); |
| 194 | |
| 195 | // Row: Optin Field Row template. |
| 196 | $this->render( 'admin/commons/sui-wizard/elements/form-field', array() ); |
| 197 | ?> |
| 198 | |
| 199 | <?php endif; ?> |
| 200 | |
| 201 | <?php |
| 202 | // DIALOG: add schedule. Only for non-ssharing modules. |
| 203 | if ( Hustle_Module_Model::SOCIAL_SHARING_MODULE !== $module->module_type ) { |
| 204 | |
| 205 | $behavior_settings = $module->get_settings()->to_array(); |
| 206 | $this->render( |
| 207 | 'admin/commons/sui-wizard/dialogs/add-schedule', |
| 208 | array( |
| 209 | 'module_type' => $module_type, |
| 210 | 'settings' => $behavior_settings['schedule'], |
| 211 | ) |
| 212 | ); |
| 213 | } |
| 214 | |
| 215 | // CHECK: Visibility Tab. |
| 216 | if ( array_key_exists( 'visibility', $wizard_tabs ) ) { |
| 217 | |
| 218 | // DIALOG: Visibility. |
| 219 | $this->render( |
| 220 | 'admin/commons/sui-wizard/dialogs/visibility-options', |
| 221 | array( 'smallcaps_singular' => $smallcaps_singular ) |
| 222 | ); |
| 223 | |
| 224 | // TEMPLATE: Conditions. |
| 225 | $this->render( |
| 226 | 'admin/commons/sui-wizard/tab-visibility/conditions', |
| 227 | array( |
| 228 | 'smallcaps_singular' => $smallcaps_singular, |
| 229 | 'module_type' => $module_type, |
| 230 | ) |
| 231 | ); |
| 232 | } |
| 233 | |
| 234 | // CHECK: Services Tab. |
| 235 | if ( array_key_exists( 'services', $wizard_tabs ) ) { |
| 236 | |
| 237 | // DIALOG: Social Platforms. |
| 238 | $this->render( |
| 239 | 'admin/commons/sui-wizard/dialogs/add-platforms', |
| 240 | array() |
| 241 | ); |
| 242 | } |
| 243 | |
| 244 | // DIALOG: Publish Flow. |
| 245 | $this->render( |
| 246 | 'admin/commons/sui-wizard/dialogs/publish-flow', |
| 247 | array( |
| 248 | 'capitalize_singular' => $capitalize_singular, |
| 249 | 'smallcaps_singular' => $smallcaps_singular, |
| 250 | ) |
| 251 | ); |
| 252 | |
| 253 | // DIALOG: delete confirmation. For tracking. |
| 254 | $this->render( 'admin/commons/sui-listing/dialogs/delete-module' ); |
| 255 | |
| 256 | // DIALOG: Dissmiss migrate tracking notice modal confirmation. |
| 257 | if ( Hustle_Notifications::is_show_migrate_tracking_notice() ) { |
| 258 | $this->render( 'admin/dialogs/migrate-dismiss-confirmation' ); |
| 259 | } |
| 260 | |
| 261 | // Preview. |
| 262 | $this->render( 'admin/dialogs/modal-preview', array( 'module_type' => $capitalize_singular ) ); |
| 263 | ?> |
| 264 |