| @@ -1,48 +1,73 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | -// This is the main view file used in the visual styler. It is used for both the "list" and "edit" view types. | |
| 6 | -// It is accessed from /wp-admin/admin.php?page=formidable-styles&frm_action=edit&form=782 | |
| 7 | - | |
| 8 | 5 | ?> |
| 9 | -<div class="frm_page_container"> | |
| 6 | +<div class="frm_wrap"> | |
| 7 | + <form id="frm_styling_form" action="" name="frm_styling_form" method="post"> | |
| 8 | + <div class="frm_page_container frm-fields"> | |
| 10 | 9 | <?php |
| 11 | - // The embed button expects that the form ID is available as a #form_id field. | |
| 10 | + FrmAppHelper::get_admin_header( | |
| 11 | + array( | |
| 12 | + 'publish' => array( 'FrmStylesHelper::styler_save_button', compact( 'style' ) ), | |
| 13 | + 'nav' => FrmStylesHelper::get_style_menu(), | |
| 14 | + 'switcher' => array( 'FrmStylesHelper::styler_switcher', compact( 'style', 'styles' ) ), | |
| 15 | + ) | |
| 16 | + ); | |
| 12 | 17 | ?> |
| 13 | - <input type="hidden" id="form_id" value="<?php echo absint( $form->id ); ?>" /> | |
| 14 | 18 | |
| 15 | - <?php | |
| 16 | - // Wrap the header in a .frm_wrap element so the h1 tag gets styled properly. | |
| 17 | - // We want to avoid putting .frm_wrap on the whole page container to avoid back end styling in the visual styler preview. | |
| 18 | - ?> | |
| 19 | - <div class="frm_wrap"> | |
| 20 | - <?php | |
| 21 | - FrmAppHelper::get_admin_header( | |
| 22 | - array( | |
| 23 | - 'form' => $form, | |
| 24 | - 'hide_title' => true, | |
| 25 | - 'publish' => array( | |
| 26 | - 'FrmFormsController::form_publish_button', | |
| 27 | - array( | |
| 28 | - 'values' => array( | |
| 29 | - // Pass this so that the Preview dropdown works. | |
| 30 | - 'form_key' => $form->form_key, | |
| 31 | - ), | |
| 32 | - ), | |
| 33 | - ), | |
| 34 | - ) | |
| 35 | - ); | |
| 36 | - ?> | |
| 19 | + <div class="columns-2"> | |
| 20 | + <div class="frm-right-panel styling_settings"> | |
| 21 | + <input name="prev_menu_order" type="hidden" value="<?php echo esc_attr( $style->menu_order ); ?>" /> | |
| 22 | + <input type="hidden" name="style_name" value="frm_style_<?php echo esc_attr( $style->post_name ); ?>" /> | |
| 23 | + <div class="frm-inner-content"> | |
| 24 | + <p> | |
| 25 | + <label for="menu-name"> | |
| 26 | + <?php esc_html_e( 'Style Name', 'formidable' ); ?> | |
| 27 | + <?php if ( $style->ID ) { ?> | |
| 28 | + <span class="howto alignright"> | |
| 29 | + <span>.frm_style_<?php echo esc_attr( $style->post_name ); ?></span> | |
| 30 | + </span> | |
| 31 | + <?php } ?> | |
| 32 | + </label> | |
| 33 | + <input id="menu-name" name="<?php echo esc_attr( $frm_style->get_field_name( 'post_title', '' ) ); ?>" type="text" class="frm_full" title="<?php esc_attr_e( 'Enter style name here', 'formidable' ); ?>" value="<?php echo esc_attr( $style->post_title ); ?>" /> | |
| 34 | + </p> | |
| 35 | + | |
| 36 | + <p> | |
| 37 | + <label class="default-style-box" for="menu_order"> | |
| 38 | + <?php if ( $style->menu_order ) { ?> | |
| 39 | + <input name="<?php echo esc_attr( $frm_style->get_field_name( 'menu_order', '' ) ); ?>" type="hidden" value="1" /> | |
| 40 | + <input id="menu_order" disabled="disabled" type="checkbox" value="1" <?php checked( $style->menu_order, 1 ); ?> /> | |
| 41 | + <?php } else { ?> | |
| 42 | + <input id="menu_order" name="<?php echo esc_attr( $frm_style->get_field_name( 'menu_order', '' ) ); ?>" type="checkbox" value="1" <?php checked( $style->menu_order, 1 ); ?> /> | |
| 43 | + <?php } ?> | |
| 44 | + <?php esc_html_e( 'Make this the default style', 'formidable' ); ?></span> | |
| 45 | + </label> | |
| 46 | + </p> | |
| 47 | + <?php do_action( 'frm_style_settings_top', $style ); ?> | |
| 48 | + </div> | |
| 49 | + <?php FrmStylesController::do_accordion_sections( FrmStylesController::$screen, 'side', compact( 'style', 'frm_style' ) ); ?> | |
| 37 | 50 | </div> |
| 38 | - <div id="frm_styler_wrapper" class="columns-2"> | |
| 39 | - <?php | |
| 40 | - $view_file = 'list' === $view ? 'list' : 'edit'; | |
| 41 | - // Render view based on type (either _styles-list.php or _styles-edit.php). | |
| 42 | - require $style_views_path . '_styles-' . $view_file . '.php'; | |
| 51 | + <div id="post-body-content"> | |
| 52 | + <?php do_action( 'frm_style_switcher', $style, $styles ); ?> | |
| 43 | 53 | |
| 44 | - // Render preview container. | |
| 45 | - require $style_views_path . '_style-preview-container.php'; | |
| 46 | - ?> | |
| 54 | + <div class="frm-inner-content"> | |
| 55 | + | |
| 56 | + <?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> | |
| 57 | + | |
| 58 | + <input type="hidden" name="ID" value="<?php echo esc_attr( $style->ID ); ?>" /> | |
| 59 | + <input type="hidden" name="frm_action" value="save" /> | |
| 60 | + <textarea name="<?php echo esc_attr( $frm_style->get_field_name( 'custom_css' ) ); ?>" class="frm_hidden"><?php echo FrmAppHelper::esc_textarea( $style->post_content['custom_css'] ); // WPCS: XSS ok. ?></textarea> | |
| 61 | + <?php wp_nonce_field( 'frm_style_nonce', 'frm_style' ); ?> | |
| 62 | + <?php FrmTipsHelper::pro_tip( 'get_styling_tip', 'p' ); ?> | |
| 63 | + | |
| 64 | + <?php include( dirname( __FILE__ ) . '/_sample_form.php' ); ?> | |
| 65 | + | |
| 66 | + </div> | |
| 47 | 67 | </div> |
| 48 | 68 | </div> |
| 69 | +</div> | |
| 70 | +</form> | |
| 71 | +</div> | |
| 72 | + | |
| 73 | +<div id="this_css"></div> | |