PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.10
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.10
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / helpers / FrmOnboardingWizardHelper.php

FrmOnboardingWizardHelper.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.10, at classes/helpers/FrmOnboardingWizardHelper.php

138 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Onboarding Wizard Helper class.
4 *
5 * @package Formidable
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 die( 'You are not allowed to call this page directly.' );
10 }
11
12 /**
13 * Provides helper functions for managing onboarding wizard in the admin area.
14 *
15 * @since 6.9
16 */
17 class FrmOnboardingWizardHelper {
18
19 /**
20 * Echo attributes for the addon's label tag.
21 *
22 * @since 6.9
23 *
24 * @param string $addon_key The key of addon.
25 * @param array $addon The array of addon's information.
26 * @return void
27 */
28 public static function add_addon_label_attributes( $addon_key, $addon ) {
29 $id = 'frm-onboarding-' . $addon_key . '-addon';
30 $attributes = array(
31 'for' => $id,
32 'class' => 'frm-option-box',
33 'data-title' => $addon['title'],
34 );
35
36 if ( ! empty( $addon['is-checked'] ) ) {
37 $attributes['class'] .= ' frm-checked';
38 }
39 if ( ! empty( $addon['is-disabled'] ) ) {
40 $attributes['class'] .= ' frm-disabled';
41 }
42 if ( ! empty( $addon['rel'] ) ) {
43 $attributes['rel'] = $addon['rel'];
44 }
45 if ( ! empty( $addon['is-vendor'] ) ) {
46 $attributes['data-is-vendor'] = 'true';
47 }
48
49 FrmAppHelper::array_to_html_params( $attributes, true );
50 }
51
52 /**
53 * Echo attributes for the addon's input tag.
54 *
55 * @since 6.9
56 *
57 * @param string $addon_key The key of addon.
58 * @param array $addon The array of addon's information.
59 * @return void
60 */
61 public static function add_addon_input_attributes( $addon_key, $addon ) {
62 $id = 'frm-onboarding-' . $addon_key . '-addon';
63 $attributes = array(
64 'type' => 'checkbox',
65 'name' => $id,
66 'id' => $id,
67 );
68
69 if ( ! empty( $addon['is-checked'] ) ) {
70 $attributes['checked'] = 'checked';
71 }
72 if ( ! empty( $addon['is-disabled'] ) ) {
73 $attributes['disabled'] = 'disabled';
74 }
75
76 FrmAppHelper::array_to_html_params( $attributes, true );
77 }
78
79 /**
80 * Renders the Onboarding Wizard page footer in the WordPress admin area.
81 *
82 * @since 6.9
83 *
84 * @param array $args
85 * @return void
86 */
87 public static function print_footer( $args = array() ) {
88 $defaults = array(
89 'footer-class' => '',
90 'display-back-button' => true,
91 // Primary Button Args.
92 'primary-button-text' => esc_html__( 'Next Step', 'formidable' ),
93 'primary-button-class' => '',
94 'primary-button-href' => '#',
95 'primary-button-role' => 'button',
96 // Secondary Button Args.
97 'secondary-button-text' => esc_html__( 'Skip', 'formidable' ),
98 'secondary-button-class' => '',
99 'secondary-button-href' => '#',
100 'secondary-button-role' => 'button',
101 'secondary-button-skip-step' => true,
102 );
103 $args = wp_parse_args( $args, $defaults );
104
105 // Set the primary button attributes.
106 $primary_button_attributes = array(
107 'href' => $args['primary-button-href'],
108 );
109 $primary_button_attributes['class'] = trim( 'button button-primary frm-button-primary ' . $args['primary-button-class'] );
110 if ( ! empty( $args['primary-button-id'] ) ) {
111 $primary_button_attributes['id'] = $args['primary-button-id'];
112 }
113 if ( ! empty( $args['primary-button-plugin'] ) ) {
114 $primary_button_attributes['data-plugin'] = $args['primary-button-plugin'];
115 }
116 if ( ! empty( $args['primary-button-role'] ) ) {
117 $primary_button_attributes['role'] = $args['primary-button-role'];
118 }
119
120 // Set the secondary button attributes.
121 $secondary_button_attributes = array(
122 'href' => $args['secondary-button-href'],
123 );
124 $secondary_button_attributes['class'] = trim( 'button button-secondary frm-button-secondary ' . $args['secondary-button-class'] );
125 if ( $args['secondary-button-skip-step'] ) {
126 $secondary_button_attributes['class'] .= ' frm-onboarding-skip-step';
127 }
128 if ( ! empty( $args['secondary-button-id'] ) ) {
129 $secondary_button_attributes['id'] = $args['secondary-button-id'];
130 }
131 if ( ! empty( $args['secondary-button-role'] ) ) {
132 $secondary_button_attributes['role'] = $args['secondary-button-role'];
133 }
134
135 require FrmOnboardingWizardController::get_view_path() . 'footer.php';
136 }
137 }
138