| @@ -2,36 +2,39 @@ | ||
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | ?> |
| 6 | -<div> | |
| 7 | - <p class="frm_grid_container"> | |
| 8 | - <label class="frm4 frm_form_field" for="frm_load_style"> | |
| 9 | - <?php esc_html_e( 'Load form styling', 'formidable' ); ?> | |
| 10 | - </label> | |
| 11 | - <select id="frm_load_style" name="frm_load_style" class="frm8 frm_form_field"> | |
| 12 | - <option value="all" <?php selected( $frm_settings->load_style, 'all' ); ?>> | |
| 13 | - <?php esc_html_e( 'on every page of my site', 'formidable' ); ?> | |
| 14 | - </option> | |
| 15 | - <option value="dynamic" <?php selected( $frm_settings->load_style, 'dynamic' ); ?>> | |
| 16 | - <?php esc_html_e( 'only on applicable pages', 'formidable' ); ?> | |
| 17 | - </option> | |
| 18 | - <option value="none" <?php selected( $frm_settings->load_style, 'none' ); ?>> | |
| 19 | - <?php esc_html_e( 'Don\'t use form styling on any page', 'formidable' ); ?> | |
| 20 | - </option> | |
| 21 | - </select> | |
| 22 | - </p> | |
| 6 | +<div class="frm_wrap"> | |
| 7 | + <form method="post"> | |
| 8 | + <div class="frm_page_container"> | |
| 9 | + <?php | |
| 10 | + FrmAppHelper::get_admin_header( | |
| 11 | + array( | |
| 12 | + 'label' => __( 'Manage Styles', 'formidable' ), | |
| 13 | + 'hide_title' => true, | |
| 14 | + 'publish' => array( 'FrmStylesHelper::save_button', array() ), | |
| 15 | + 'nav' => FrmStylesHelper::get_style_menu( 'manage' ), | |
| 16 | + ) | |
| 17 | + ); | |
| 18 | + ?> | |
| 23 | 19 | |
| 24 | - <?php do_action( 'frm_style_general_settings', $frm_settings ); ?> | |
| 20 | + <div class="columns-2"> | |
| 21 | + <div id="post-body-content"> | |
| 25 | 22 | |
| 23 | + <div class="frm-inner-content"> | |
| 24 | + | |
| 25 | + <h2 class="frm-h2"> | |
| 26 | + <?php esc_html_e( 'Manage Styles', 'formidable' ); ?> | |
| 27 | + </h2> | |
| 26 | 28 | <p class="howto"> |
| 27 | - <?php esc_html_e( 'Easily change which style your forms are using by making changes below.', 'formidable' ); ?> | |
| 29 | + <?php printf( esc_html__( 'Easily change which style your forms are using by making changes below.', 'formidable' ), '<a href="?page=formidable-styles&frm_action=new_style">', '</a>' ); ?> | |
| 28 | 30 | </p> |
| 29 | 31 | |
| 30 | - <?php require FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; ?> | |
| 32 | + <?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> | |
| 31 | 33 | |
| 32 | - <table class="widefat fixed striped"> | |
| 33 | - <thead> | |
| 34 | + <input type="hidden" name="frm_action" value="manage_styles"/> | |
| 35 | + <table class="widefat fixed striped"> | |
| 36 | + <thead> | |
| 34 | 37 | <tr> |
| 35 | 38 | <th scope="col" class="column-locations"> |
| 36 | 39 | <?php esc_html_e( 'Form Title', 'formidable' ); ?> |
| 37 | 40 | </th> |
| @@ -38,41 +41,57 @@ | ||
| 38 | 41 | <th scope="col"> |
| 39 | 42 | <?php esc_html_e( 'Assigned Style Templates', 'formidable' ); ?> |
| 40 | 43 | </th> |
| 41 | 44 | </tr> |
| 42 | - </thead> | |
| 43 | - <tbody> | |
| 44 | - <?php | |
| 45 | - if ( $forms ) { | |
| 46 | - $row_view_file_path = FrmAppHelper::plugin_path() . '/classes/views/styles/_manage-styles-row.php'; | |
| 47 | - array_walk( | |
| 48 | - $forms, | |
| 49 | - /** | |
| 50 | - * @param stdClass $form | |
| 51 | - * @param array<WP_Post> $styles | |
| 52 | - * @param WP_Post $default_style | |
| 53 | - * @param string $row_view_file_path | |
| 54 | - * | |
| 55 | - * @return void | |
| 56 | - */ | |
| 57 | - function ( $form ) use ( $styles, $default_style, $row_view_file_path ) { | |
| 58 | - $active_style_id = isset( $form->options['custom_style'] ) ? (int) $form->options['custom_style'] : 1; | |
| 45 | + </thead> | |
| 59 | 46 | |
| 60 | - if ( 1 === $active_style_id ) { | |
| 61 | - // Use the default style | |
| 62 | - $active_style_id = $default_style->ID; | |
| 47 | + <tbody> | |
| 48 | + <?php | |
| 49 | + if ( $forms ) { | |
| 50 | + foreach ( $forms as $form ) { | |
| 51 | + $this_style = isset( $form->options['custom_style'] ) ? (int) $form->options['custom_style'] : 1; | |
| 52 | + if ( 1 === $this_style ) { | |
| 53 | + // use the default style | |
| 54 | + $this_style = $default_style->ID; | |
| 63 | 55 | } |
| 56 | + ?> | |
| 57 | + <tr> | |
| 58 | + <td class="menu-location-title"> | |
| 59 | + <strong><?php echo esc_html( empty( $form->name ) ? __( '(no title)', 'formidable' ) : $form->name ); ?></strong> | |
| 60 | + </td> | |
| 61 | + <td> | |
| 62 | + <input type="hidden" name="prev_style[<?php echo esc_attr( $form->id ); ?>]" value="<?php echo esc_attr( $this_style ); ?>" /> | |
| 63 | + <select name="style[<?php echo esc_attr( $form->id ); ?>]"> | |
| 64 | + <?php foreach ( $styles as $s ) { ?> | |
| 65 | + <option value="<?php echo esc_attr( $s->ID ); ?>" <?php selected( $s->ID, $this_style ); ?>> | |
| 66 | + <?php echo esc_html( $s->post_title . ( empty( $s->menu_order ) ? '' : ' (' . __( 'default', 'formidable' ) . ')' ) ); ?> | |
| 67 | + </option> | |
| 68 | + <?php } ?> | |
| 69 | + <option value="" <?php selected( 0, $this_style ); ?>> | |
| 70 | + <?php esc_html_e( 'Styling disabled', 'formidable' ); ?> | |
| 71 | + </option> | |
| 72 | + </select> | |
| 64 | 73 | |
| 65 | - include $row_view_file_path; | |
| 74 | + </td> | |
| 75 | + </tr> | |
| 76 | + <?php | |
| 66 | 77 | } |
| 67 | - ); | |
| 68 | - } else { | |
| 69 | - ?> | |
| 78 | + } else { | |
| 79 | + ?> | |
| 70 | 80 | <tr> |
| 71 | 81 | <td><?php esc_html_e( 'No Forms Found', 'formidable' ); ?></td> |
| 72 | 82 | </tr> |
| 73 | - <?php | |
| 74 | - }//end if | |
| 75 | - ?> | |
| 76 | - </tbody> | |
| 77 | - </table> | |
| 83 | + <?php | |
| 84 | + } | |
| 85 | + ?> | |
| 86 | + </tbody> | |
| 87 | + </table> | |
| 88 | + <p> | |
| 89 | + <input type="submit" name="submit" class="button button-primary frm-button-primary" value="<?php esc_attr_e( 'Update', 'formidable' ); ?>" /> | |
| 90 | + </p> | |
| 91 | + <?php wp_nonce_field( 'frm_manage_style_nonce', 'frm_manage_style' ); ?> | |
| 92 | + | |
| 93 | +</div> | |
| 94 | +</div> | |
| 95 | +</div> | |
| 96 | +</form> | |
| 78 | 97 | </div> |