| @@ -7,19 +7,20 @@ | ||
| 7 | 7 | // It is accessed from /wp-admin/admin.php?page=formidable-styles&form=782 |
| 8 | 8 | |
| 9 | 9 | $frm_settings = FrmAppHelper::get_settings(); |
| 10 | 10 | $globally_disabled = 'none' === $frm_settings->load_style; |
| 11 | -$enabled = '0' !== $form->options['custom_style'] && ! $globally_disabled; | |
| 11 | +$enabled = ( ! is_array( $form->options ) || 0 !== (int) $form->options['custom_style'] ) && ! $globally_disabled; | |
| 12 | 12 | $card_helper = new FrmStylesCardHelper( $active_style, $default_style, $form->id, $enabled ); |
| 13 | 13 | $styles = $card_helper->get_styles(); |
| 14 | 14 | $custom_styles = $card_helper->filter_custom_styles( $styles ); |
| 15 | 15 | $sidebar_params = array( |
| 16 | 16 | 'id' => 'frm_style_sidebar', |
| 17 | - 'class' => 'frm-right-panel frm-p-6 frm_wrap', // Make sure not to put .frm_wrap on the whole container because it will cause admin styles to apply to style cards. | |
| 17 | + // Make sure not to put .frm_wrap on the whole container because it will cause admin styles to apply to style cards. | |
| 18 | + 'class' => 'frm-right-panel frm-p-6 frm_wrap', | |
| 18 | 19 | ); |
| 19 | 20 | $toggle_input_html = array(); |
| 20 | 21 | if ( $globally_disabled ) { |
| 21 | - $sidebar_params['class'] .= ' frm-styles-globally-disabled'; | |
| 22 | + $sidebar_params['class'] .= ' frm-styles-globally-disabled'; | |
| 22 | 23 | $toggle_input_html['disabled'] = 'disabled'; |
| 23 | 24 | } |
| 24 | 25 | ?> |
| 25 | 26 | <div <?php FrmAppHelper::array_to_html_params( $sidebar_params, true ); ?>> |
| @@ -25,9 +26,9 @@ | ||
| 25 | 26 | <div <?php FrmAppHelper::array_to_html_params( $sidebar_params, true ); ?>> |
| 26 | 27 | <?php |
| 27 | 28 | $can_create_styles = class_exists( 'FrmProStylesPreviewHelper' ); |
| 28 | 29 | $trigger_params = array( |
| 29 | - 'id' => 'frm_new_style_trigger', | |
| 30 | + 'id' => 'frm_new_style_trigger', | |
| 30 | 31 | 'href' => '#', |
| 31 | 32 | ); |
| 32 | 33 | if ( $can_create_styles ) { |
| 33 | 34 | $trigger_params['data-new-style-url'] = esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=new_style' ) ); |
| @@ -37,9 +38,11 @@ | ||
| 37 | 38 | $trigger_params['data-message'] = __( 'Upgrade to create and manage as many form styles as you need.', 'formidable' ); |
| 38 | 39 | $trigger_params['data-image'] = 'styles-upsell.svg'; |
| 39 | 40 | } |
| 40 | 41 | ?> |
| 41 | - <?php // This form isn't visible. It's just used for assigning the selected style id to the target form. ?> | |
| 42 | + <?php | |
| 43 | + // This form isn't visible. It's just used for assigning the selected style id to the target form. | |
| 44 | + ?> | |
| 42 | 45 | <form id="frm_style_list_form" method="post" action="<?php echo esc_url( FrmStylesHelper::get_list_url( $form->id ) ); ?>"> |
| 43 | 46 | <input type="hidden" name="style_id" value="<?php echo absint( $enabled ? $active_style->ID : 0 ); ?>" /> |
| 44 | 47 | <input type="hidden" name="form_id" value="<?php echo absint( $form->id ); ?>" /> |
| 45 | 48 | <input type="hidden" name="frm_action" value="assign_style" /> |
| @@ -44,9 +47,9 @@ | ||
| 44 | 47 | <input type="hidden" name="form_id" value="<?php echo absint( $form->id ); ?>" /> |
| 45 | 48 | <input type="hidden" name="frm_action" value="assign_style" /> |
| 46 | 49 | <?php wp_nonce_field( 'frm_save_form_style_nonce', 'frm_save_form_style' ); ?> |
| 47 | 50 | </form> |
| 48 | - <div class="frm-mb-sm frm-flex-justify"> | |
| 51 | + <div class="frm-mb-sm frm-flex-justify frm-style-component"> | |
| 49 | 52 | <?php |
| 50 | 53 | FrmHtmlHelper::toggle( |
| 51 | 54 | 'frm_enable_styling', |
| 52 | 55 | 'frm_enable_styling', |
| @@ -54,9 +57,9 @@ | ||
| 54 | 57 | 'checked' => $enabled, |
| 55 | 58 | 'on_label' => __( 'Enable Formidable styling', 'formidable' ), |
| 56 | 59 | 'show_labels' => true, |
| 57 | 60 | 'echo' => true, |
| 58 | - 'input_html' => $toggle_input_html, | |
| 61 | + 'input_html' => $toggle_input_html, | |
| 59 | 62 | ) |
| 60 | 63 | ); |
| 61 | 64 | ?> |
| 62 | 65 | <div id="frm_new_style_trigger_wrapper"> |
| @@ -80,9 +83,12 @@ | ||
| 80 | 83 | </div> |
| 81 | 84 | <?php $card_helper->echo_card_wrapper( 'frm_custom_style_cards_wrapper', $custom_styles ); ?> |
| 82 | 85 | <?php } ?> |
| 83 | 86 | |
| 84 | - <div class="frm_form_settings"> | |
| 85 | - <h2><?php esc_html_e( 'Formidable Styles', 'formidable' ); ?></h2> | |
| 86 | - </div> | |
| 87 | - <?php $card_helper->echo_card_wrapper( 'frm_template_style_cards_wrapper', $card_helper->get_template_info() ); ?> | |
| 87 | + <?php $style_templates = array_filter( $card_helper->get_template_info(), 'is_array' ); ?> | |
| 88 | + <?php if ( $style_templates ) { ?> | |
| 89 | + <div class="frm_form_settings"> | |
| 90 | + <h2><?php esc_html_e( 'Formidable Styles', 'formidable' ); ?></h2> | |
| 91 | + </div> | |
| 92 | + <?php $card_helper->echo_card_wrapper( 'frm_template_style_cards_wrapper', $style_templates ); ?> | |
| 93 | + <?php } ?> | |
| 88 | 94 | </div> |