testimonials.php
6.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?php
/**
* @class FLTestimonialsModule
*/
class FLTestimonialsModule extends FLBuilderModule {
/**
* @method __construct
*/
public function __construct()
{
parent::__construct(array(
'name' => __('客户评价', 'fl-builder'),
'description' => __('An animated tesimonials area.', 'fl-builder'),
'category' => __('高级模块', 'fl-builder'),
'partial_refresh' => true
));
$this->add_css('jquery-bxslider');
$this->add_css('font-awesome');
$this->add_js('jquery-bxslider');
}
}
/**
* Register the module and its form settings.
*/
FLBuilder::register_module('FLTestimonialsModule', array(
'general' => array( // Tab
'title' => __('General', 'fl-builder'), // Tab title
'sections' => array( // Tab Sections
'general' => array( // Section
'title' => '', // Section Title
'fields' => array( // Section Fields
'layout' => array(
'type' => 'select',
'label' => __('Layout', 'fl-builder'),
'default' => 'compact',
'options' => array(
'wide' => __('Wide', 'fl-builder'),
'compact' => __('Compact', 'fl-builder')
),
'toggle' => array(
'compact' => array(
'sections' => array('heading', 'arrow_nav')
),
'wide' => array(
'sections' => array('dot_nav')
)
),
'help' => __('Wide is for 1 column rows, compact is for multi-column rows.', 'fl-builder')
)
)
),
'heading' => array( // Section
'title' => __('Heading', 'fl-builder'), // Section Title
'fields' => array( // Section Fields
'heading' => array(
'type' => 'text',
'default' => __( 'Testimonials', 'fl-builder' ),
'label' => __('Heading', 'fl-builder'),
'preview' => array(
'type' => 'text',
'selector' => '.fl-testimonials-heading'
)
),
'heading_size' => array(
'type' => 'text',
'label' => __('Heading Size', 'fl-builder'),
'default' => '24',
'maxlength' => '3',
'size' => '4',
'description' => 'px'
)
)
),
'slider' => array( // Section
'title' => __('Slider Settings', 'fl-builder'), // Section Title
'fields' => array( // Section Fields
'auto_play' => array(
'type' => 'select',
'label' => __('Auto Play', 'fl-builder'),
'default' => '1',
'options' => array(
'0' => __('No', 'fl-builder'),
'1' => __('Yes', 'fl-builder')
)
),
'pause' => array(
'type' => 'text',
'label' => __('Delay', 'fl-builder'),
'default' => '4',
'maxlength' => '4',
'size' => '5',
'description' => _x( 'seconds', 'Value unit for form field of time in seconds. Such as: "5 seconds"', 'fl-builder' )
),
'transition' => array(
'type' => 'select',
'label' => __('Transition', 'fl-builder'),
'default' => 'slide',
'options' => array(
'horizontal' => _x( 'Slide', 'Transition type.', 'fl-builder' ),
'fade' => __( 'Fade', 'fl-builder' )
)
),
'speed' => array(
'type' => 'text',
'label' => __('Transition Speed', 'fl-builder'),
'default' => '0.5',
'maxlength' => '4',
'size' => '5',
'description' => _x( 'seconds', 'Value unit for form field of time in seconds. Such as: "5 seconds"', 'fl-builder' )
)
)
),
'arrow_nav' => array( // Section
'title' => '',
'fields' => array( // Section Fields
'arrows' => array(
'type' => 'select',
'label' => __('Show Arrows', 'fl-builder'),
'default' => '1',
'options' => array(
'0' => __('No', 'fl-builder'),
'1' => __('Yes', 'fl-builder')
),
'toggle' => array(
'1' => array(
'fields' => array('arrow_color')
)
)
),
'arrow_color' => array(
'type' => 'color',
'label' => __('Arrow Color', 'fl-builder'),
'default' => '999999',
'show_reset' => true,
'preview' => array(
'type' => 'css',
'selector' => '.fl-testimonials-wrap .fa',
'property' => 'color'
)
)
)
),
'dot_nav' => array( // Section
'title' => '', // Section Title
'fields' => array( // Section Fields
'dots' => array(
'type' => 'select',
'label' => __('Show Dots', 'fl-builder'),
'default' => '1',
'options' => array(
'0' => __('No', 'fl-builder'),
'1' => __('Yes', 'fl-builder')
),
'toggle' => array(
'1' => array(
'fields' => array('dot_color')
)
)
),
'dot_color' => array(
'type' => 'color',
'label' => __('Dot Color', 'fl-builder'),
'default' => '999999',
'show_reset' => true
)
)
)
)
),
'testimonials' => array( // Tab
'title' => __('Testimonials', 'fl-builder'), // Tab title
'sections' => array( // Tab Sections
'general' => array( // Section
'title' => '', // Section Title
'fields' => array( // Section Fields
'testimonials' => array(
'type' => 'form',
'label' => __('Testimonial', 'fl-builder'),
'form' => 'testimonials_form', // ID from registered form below
'preview_text' => 'testimonial', // Name of a field to use for the preview text
'multiple' => true
),
)
)
)
)
));
/**
* Register a settings form to use in the "form" field type above.
*/
FLBuilder::register_settings_form('testimonials_form', array(
'title' => __('Add Testimonial', 'fl-builder'),
'tabs' => array(
'general' => array( // Tab
'title' => __('General', 'fl-builder'), // Tab title
'sections' => array( // Tab Sections
'general' => array( // Section
'title' => '', // Section Title
'fields' => array( // Section Fields
'testimonial' => array(
'type' => 'editor',
'label' => ''
)
)
)
)
)
)
));