icon-group.php
5.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
<?php
/**
* @class FLIconGroupModule
*/
class FLIconGroupModule extends FLBuilderModule {
/**
* @method __construct
*/
public function __construct()
{
parent::__construct(array(
'name' => __('图标+标题(多个)', 'fl-builder'),
'description' => __('Display a group of linked Font Awesome icons.', 'fl-builder'),
'category' => __('图文模块', 'fl-builder'),
'editor_export' => false,
'partial_refresh' => true
));
}
}
/**
* Register the module and its form settings.
*/
FLBuilder::register_module('FLIconGroupModule', array(
'icons' => array(
'title' => __('Icons', 'fl-builder'),
'sections' => array(
'general' => array(
'title' => '',
'fields' => array(
'icons' => array(
'type' => 'form',
'label' => __('Icon', 'fl-builder'),
'form' => 'icon_group_form', // ID from registered form below
'preview_text' => 'icon', // Name of a field to use for the preview text
'multiple' => true
)
)
)
)
),
'style' => array( // Tab
'title' => __('Style', 'fl-builder'), // Tab title
'sections' => array( // Tab Sections
'colors' => array( // Section
'title' => __('Colors', 'fl-builder'), // Section Title
'fields' => array( // Section Fields
'color' => array(
'type' => 'color',
'label' => __('Color', 'fl-builder'),
'show_reset' => true
),
'hover_color' => array(
'type' => 'color',
'label' => __('Hover Color', 'fl-builder'),
'show_reset' => true,
'preview' => array(
'type' => 'none'
)
),
'bg_color' => array(
'type' => 'color',
'label' => __('Background Color', 'fl-builder'),
'show_reset' => true
),
'bg_hover_color' => array(
'type' => 'color',
'label' => __('Background Hover Color', 'fl-builder'),
'show_reset' => true,
'preview' => array(
'type' => 'none'
)
),
'three_d' => array(
'type' => 'select',
'label' => __('Gradient', 'fl-builder'),
'default' => '0',
'options' => array(
'0' => __('No', 'fl-builder'),
'1' => __('Yes', 'fl-builder')
)
)
)
),
'structure' => array( // Section
'title' => __('Structure', 'fl-builder'), // Section Title
'fields' => array( // Section Fields
'size' => array(
'type' => 'text',
'label' => __('Size', 'fl-builder'),
'default' => '30',
'maxlength' => '3',
'size' => '4',
'description' => 'px'
),
'spacing' => array(
'type' => 'text',
'label' => __('Spacing', 'fl-builder'),
'default' => '10',
'maxlength' => '2',
'size' => '4',
'description' => 'px'
),
'align' => array(
'type' => 'select',
'label' => __('Alignment', 'fl-builder'),
'default' => 'center',
'options' => array(
'center' => __('Center', 'fl-builder'),
'left' => __('Left', 'fl-builder'),
'right' => __('Right', 'fl-builder')
)
)
)
)
)
)
));
/**
* Register a settings form to use in the "form" field type above.
*/
FLBuilder::register_settings_form('icon_group_form', array(
'title' => __('Add Icon', '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
'icon' => array(
'type' => 'icon',
'label' => __('Icon', 'fl-builder')
),
'link' => array(
'type' => 'link',
'label' => __('Link', 'fl-builder')
),
'link_target' => array(
'type' => 'select',
'label' => __('Link Target', 'fl-builder'),
'default' => '_blank',
'options' => array(
'_self' => __('Same Window', 'fl-builder'),
'_blank' => __('New Window', 'fl-builder')
)
)
)
)
)
),
'style' => array( // Tab
'title' => __('Style', 'fl-builder'), // Tab title
'sections' => array( // Tab Sections
'colors' => array( // Section
'title' => __('Colors', 'fl-builder'), // Section Title
'fields' => array( // Section Fields
'color' => array(
'type' => 'color',
'label' => __('Color', 'fl-builder'),
'show_reset' => true
),
'hover_color' => array(
'type' => 'color',
'label' => __('Hover Color', 'fl-builder'),
'show_reset' => true,
'preview' => array(
'type' => 'none'
)
),
'bg_color' => array(
'type' => 'color',
'label' => __('Background Color', 'fl-builder'),
'show_reset' => true
),
'bg_hover_color' => array(
'type' => 'color',
'label' => __('Background Hover Color', 'fl-builder'),
'show_reset' => true,
'preview' => array(
'type' => 'none'
)
)
)
)
)
)
)
));