Conditions | 4 |
Paths | 2 |
Total Lines | 451 |
Code Lines | 355 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
62 | function add_common_fields( $fields, $template ) { |
||
|
|||
63 | //check if the template supports the common fields |
||
64 | if ( $template && array_key_exists( 'common_fields_support', $template ) && true === $template['common_fields_support'] ) { |
||
65 | |||
66 | //region Appearance Fields |
||
67 | $fields[] = array( |
||
68 | 'id' => 'theme', |
||
69 | 'title' => __( 'Theme', 'foogallery' ), |
||
70 | 'desc' => __( 'The overall appearance of the items in the gallery, affecting the border, background, font and shadow colors.', 'foogallery' ), |
||
71 | 'section' => __( 'Appearance', 'foogallery' ), |
||
72 | 'type' => 'radio', |
||
73 | 'default' => 'fg-light', |
||
74 | 'spacer' => '<span class="spacer"></span>', |
||
75 | 'choices' => array( |
||
76 | 'fg-light' => __( 'Light', 'foogallery' ), |
||
77 | 'fg-dark' => __( 'Dark', 'foogallery' ), |
||
78 | 'fg-custom' => __( 'Custom', 'foogallery' ) |
||
79 | ), |
||
80 | 'row_data' => array( |
||
81 | 'data-foogallery-change-selector' => 'input:radio', |
||
82 | 'data-foogallery-preview' => 'class' |
||
83 | ) |
||
84 | ); |
||
85 | |||
86 | $fields[] = array( |
||
87 | 'id' => 'border_size', |
||
88 | 'title' => __( 'Border Size', 'foogallery' ), |
||
89 | 'desc' => __( 'The border size applied to each thumbnail', 'foogallery' ), |
||
90 | 'section' => __( 'Appearance', 'foogallery' ), |
||
91 | 'type' => 'radio', |
||
92 | 'spacer' => '<span class="spacer"></span>', |
||
93 | 'default' => 'fg-border-thin', |
||
94 | 'choices' => array( |
||
95 | '' => __( 'None', 'foogallery' ), |
||
96 | 'fg-border-thin' => __( 'Thin', 'foogallery' ), |
||
97 | 'fg-border-medium' => __( 'Medium', 'foogallery' ), |
||
98 | 'fg-border-thick' => __( 'Thick', 'foogallery' ), |
||
99 | ), |
||
100 | 'row_data' => array( |
||
101 | 'data-foogallery-change-selector' => 'input:radio', |
||
102 | 'data-foogallery-preview' => 'class' |
||
103 | ) |
||
104 | ); |
||
105 | |||
106 | $fields[] = array( |
||
107 | 'id' => 'rounded_corners', |
||
108 | 'title' => __( 'Rounded Corners', 'foogallery' ), |
||
109 | 'desc' => __( 'The border radius, or rounded corners applied to each thumbnail', 'foogallery' ), |
||
110 | 'section' => __( 'Appearance', 'foogallery' ), |
||
111 | 'type' => 'radio', |
||
112 | 'spacer' => '<span class="spacer"></span>', |
||
113 | 'default' => '', |
||
114 | 'choices' => array( |
||
115 | '' => __( 'None', 'foogallery' ), |
||
116 | 'fg-round-small' => __( 'Small', 'foogallery' ), |
||
117 | 'fg-round-medium' => __( 'Medium', 'foogallery' ), |
||
118 | 'fg-round-large' => __( 'Large', 'foogallery' ), |
||
119 | 'fg-round-full' => __( 'Full', 'foogallery' ), |
||
120 | ), |
||
121 | 'row_data' => array( |
||
122 | 'data-foogallery-change-selector' => 'input:radio', |
||
123 | 'data-foogallery-preview' => 'class' |
||
124 | ) |
||
125 | ); |
||
126 | |||
127 | $fields[] = array( |
||
128 | 'id' => 'drop_shadow', |
||
129 | 'title' => __( 'Drop Shadow', 'foogallery' ), |
||
130 | 'desc' => __( 'The outer or drop shadow applied to each thumbnail', 'foogallery' ), |
||
131 | 'section' => __( 'Appearance', 'foogallery' ), |
||
132 | 'type' => 'radio', |
||
133 | 'spacer' => '<span class="spacer"></span>', |
||
134 | 'default' => 'fg-shadow-outline', |
||
135 | 'choices' => array( |
||
136 | '' => __( 'None', 'foogallery' ), |
||
137 | 'fg-shadow-outline' => __( 'Outline', 'foogallery' ), |
||
138 | 'fg-shadow-small' => __( 'Small', 'foogallery' ), |
||
139 | 'fg-shadow-medium' => __( 'Medium', 'foogallery' ), |
||
140 | 'fg-shadow-large' => __( 'Large', 'foogallery' ), |
||
141 | ), |
||
142 | 'row_data' => array( |
||
143 | 'data-foogallery-change-selector' => 'input:radio', |
||
144 | 'data-foogallery-preview' => 'class' |
||
145 | ) |
||
146 | ); |
||
147 | |||
148 | $fields[] = array( |
||
149 | 'id' => 'inner_shadow', |
||
150 | 'title' => __( 'Inner Shadow', 'foogallery' ), |
||
151 | 'desc' => __( 'The inner shadow applied to each thumbnail', 'foogallery' ), |
||
152 | 'section' => __( 'Appearance', 'foogallery' ), |
||
153 | 'type' => 'radio', |
||
154 | 'spacer' => '<span class="spacer"></span>', |
||
155 | 'default' => '', |
||
156 | 'choices' => array( |
||
157 | '' => __( 'None', 'foogallery' ), |
||
158 | 'fg-shadow-inset-small' => __( 'Small', 'foogallery' ), |
||
159 | 'fg-shadow-inset-medium' => __( 'Medium', 'foogallery' ), |
||
160 | 'fg-shadow-inset-large' => __( 'Large', 'foogallery' ), |
||
161 | ), |
||
162 | 'row_data' => array( |
||
163 | 'data-foogallery-change-selector' => 'input:radio', |
||
164 | 'data-foogallery-preview' => 'class' |
||
165 | ) |
||
166 | ); |
||
167 | |||
168 | $fields[] = array( |
||
169 | 'id' => 'loading_icon', |
||
170 | 'title' => __( 'Loading Icon', 'foogallery' ), |
||
171 | 'desc' => __( 'An animated loading icon can be shown while the thumbnails are busy loading.', 'foogallery' ), |
||
172 | 'section' => __( 'Appearance', 'foogallery' ), |
||
173 | 'default' => 'fg-loading-default', |
||
174 | 'type' => 'htmlicon', |
||
175 | 'choices' => apply_filters( |
||
176 | 'foogallery_gallery_template_common_thumbnail_fields_loading_icon_choices', array( |
||
177 | '' => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon"></div>' ), |
||
178 | 'fg-loading-default' => array( 'label' => __( 'Default', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-default"><div class="fg-loader"></div></div>' ), |
||
179 | 'fg-loading-bars' => array( 'label' => __( 'Bars', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-bars"><div class="fg-loader"></div></div>' ), |
||
180 | 'fg-loading-dots' => array( 'label' => __( 'Dots', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-dots"><div class="fg-loader"></div></div>' ), |
||
181 | 'fg-loading-partial' => array( 'label' => __( 'Partial', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-partial"><div class="fg-loader"></div></div>' ), |
||
182 | 'fg-loading-pulse' => array( 'label' => __( 'Pulse', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-pulse"><div class="fg-loader"></div></div>' ), |
||
183 | 'fg-loading-trail' => array( 'label' => __( 'Trail', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-trail"><div class="fg-loader"></div></div>' ), |
||
184 | ) |
||
185 | ), |
||
186 | 'row_data' => array( |
||
187 | 'data-foogallery-change-selector' => 'input:radio', |
||
188 | 'data-foogallery-preview' => 'class' |
||
189 | ) |
||
190 | ); |
||
191 | |||
192 | $fields[] = array( |
||
193 | 'id' => 'loaded_effect', |
||
194 | 'title' => __( 'Loaded Effect', 'foogallery' ), |
||
195 | 'desc' => __( 'The animation effect used to display the thumbnail, once it has loaded.', 'foogallery' ), |
||
196 | 'section' => __( 'Appearance', 'foogallery' ), |
||
197 | 'default' => 'fg-loaded-fade-in', |
||
198 | 'type' => 'select', |
||
199 | 'choices' => apply_filters( |
||
200 | 'foogallery_gallery_template_common_thumbnail_fields_loaded_effect_choices', array( |
||
201 | '' => __( 'None', 'foogallery' ), |
||
202 | 'fg-loaded-fade-in' => __( 'Fade In', 'foogallery' ), |
||
203 | 'fg-loaded-slide-up' => __( 'Slide Up', 'foogallery' ), |
||
204 | 'fg-loaded-slide-down' => __( 'Slide Down', 'foogallery' ), |
||
205 | 'fg-loaded-slide-left' => __( 'Slide Left', 'foogallery' ), |
||
206 | 'fg-loaded-slide-right' => __( 'Slide Right', 'foogallery' ), |
||
207 | 'fg-loaded-scale-up' => __( 'Scale Up', 'foogallery' ), |
||
208 | 'fg-loaded-swing-down' => __( 'Swing Down', 'foogallery' ), |
||
209 | 'fg-loaded-drop' => __( 'Drop', 'foogallery' ), |
||
210 | 'fg-loaded-fly' => __( 'Fly', 'foogallery' ), |
||
211 | 'fg-loaded-flip' => __( 'Flip', 'foogallery' ), |
||
212 | ) |
||
213 | ), |
||
214 | 'row_data' => array( |
||
215 | 'data-foogallery-change-selector' => 'input:radio', |
||
216 | 'data-foogallery-preview' => 'class' |
||
217 | ) |
||
218 | ); |
||
219 | //endregion |
||
220 | |||
221 | //region Hover Effects Fields |
||
222 | $fields[] = array( |
||
223 | 'id' => 'hover_effect_help', |
||
224 | 'title' => __( 'Hover Effect Help', 'foogallery' ), |
||
225 | 'desc' => __( 'A preset provides a stylish and pre-defined look & feel for when you hover over the thumbnails.', 'foogallery' ), |
||
226 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
227 | 'type' => 'help' |
||
228 | ); |
||
229 | |||
230 | $fields[] = array( |
||
231 | 'id' => 'hover_effect_preset', |
||
232 | 'title' => __( 'Preset', 'foogallery' ), |
||
233 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
234 | 'default' => 'fg-custom', |
||
235 | 'type' => 'radio', |
||
236 | 'choices' => apply_filters( |
||
237 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_choices', array( |
||
238 | '' => __( 'None', 'foogallery' ), |
||
239 | 'fg-custom' => __( 'Custom', 'foogallery' ), |
||
240 | ) |
||
241 | ), |
||
242 | 'spacer' => '<span class="spacer"></span>', |
||
243 | 'desc' => __( 'A preset styling that is used for the captions. If you want to define your own custom captions, then choose Custom.', 'foogallery' ), |
||
244 | 'row_data' => array( |
||
245 | 'data-foogallery-change-selector' => 'input:radio', |
||
246 | 'data-foogallery-value-selector' => 'input:checked', |
||
247 | 'data-foogallery-preview' => 'class' |
||
248 | ) |
||
249 | ); |
||
250 | |||
251 | $fields[] = array( |
||
252 | 'id' => 'hover_effect_preset_size', |
||
253 | 'title' => __( 'Preset Size', 'foogallery' ), |
||
254 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
255 | 'default' => 'fg-preset-small', |
||
256 | 'spacer' => '<span class="spacer"></span>', |
||
257 | 'type' => 'radio', |
||
258 | 'choices' => apply_filters( |
||
259 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_size_choices', array( |
||
260 | 'fg-preset-small' => __( 'Small', 'foogallery' ), |
||
261 | 'fg-preset-medium' => __( 'Medium', 'foogallery' ), |
||
262 | 'fg-preset-large' => __( 'Large', 'foogallery' ), |
||
263 | ) |
||
264 | ), |
||
265 | 'desc' => __( 'Choose an appropriate size for the preset caption effects, based on the size of your thumbs. Choose small for thumbs 150-200 wide, medium for thumbs 200-400 wide, and large for thumbs over 400 wide.', 'foogallery' ), |
||
266 | 'row_data' => array( |
||
267 | 'data-foogallery-change-selector' => 'input:radio', |
||
268 | 'data-foogallery-hidden' => true, |
||
269 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
270 | 'data-foogallery-show-when-field-operator' => 'indexOf', |
||
271 | 'data-foogallery-show-when-field-value' => 'fg-preset', |
||
272 | 'data-foogallery-preview' => 'class' |
||
273 | ) |
||
274 | ); |
||
275 | |||
276 | $fields[] = array( |
||
277 | 'id' => 'hover_effect_color', |
||
278 | 'title' => __( 'Color Effect', 'foogallery' ), |
||
279 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
280 | 'default' => '', |
||
281 | 'spacer' => '<span class="spacer"></span>', |
||
282 | 'type' => 'radio', |
||
283 | 'choices' => apply_filters( |
||
284 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_color_choices', array( |
||
285 | '' => __( 'None', 'foogallery' ), |
||
286 | 'fg-hover-colorize' => __( 'Colorize', 'foogallery' ), |
||
287 | 'fg-hover-grayscale' => __( 'Greyscale', 'foogallery' ), |
||
288 | ) |
||
289 | ), |
||
290 | 'desc' => __( 'Choose an color effect that is applied when you hover over a thumbnail.', 'foogallery' ), |
||
291 | 'row_data' => array( |
||
292 | 'data-foogallery-change-selector' => 'input:radio', |
||
293 | 'data-foogallery-hidden' => true, |
||
294 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
295 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
296 | 'data-foogallery-preview' => 'class' |
||
297 | ) |
||
298 | ); |
||
299 | |||
300 | $fields[] = array( |
||
301 | 'id' => 'hover_effect_scale', |
||
302 | 'title' => __( 'Scaling Effect', 'foogallery' ), |
||
303 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
304 | 'default' => '', |
||
305 | 'spacer' => '<span class="spacer"></span>', |
||
306 | 'type' => 'radio', |
||
307 | 'choices' => apply_filters( |
||
308 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_scale_choices', array( |
||
309 | '' => __( 'None', 'foogallery' ), |
||
310 | 'fg-hover-scale' => __( 'Scaled', 'foogallery' ), |
||
311 | ) |
||
312 | ), |
||
313 | 'desc' => __( 'Apply a slight scaling effect when hovering over a thumbnail.', 'foogallery' ), |
||
314 | 'row_data' => array( |
||
315 | 'data-foogallery-change-selector' => 'input:radio', |
||
316 | 'data-foogallery-hidden' => true, |
||
317 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
318 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
319 | 'data-foogallery-preview' => 'class' |
||
320 | ) |
||
321 | ); |
||
322 | |||
323 | $fields[] = array( |
||
324 | 'id' => 'hover_effect_caption_visibility', |
||
325 | 'title' => __( 'Caption Visibility', 'foogallery' ), |
||
326 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
327 | 'default' => 'fg-caption-hover', |
||
328 | 'spacer' => '<span class="spacer"></span>', |
||
329 | 'type' => 'radio', |
||
330 | 'choices' => apply_filters( |
||
331 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_caption_visibility_choices', array( |
||
332 | '' => __( 'None', 'foogallery' ), |
||
333 | 'fg-caption-hover' => __( 'On Hover', 'foogallery' ), |
||
334 | 'fg-caption-always' => __( 'Always Visible', 'foogallery' ), |
||
335 | ) |
||
336 | ), |
||
337 | 'desc' => __( 'Choose how the captions will be displayed.', 'foogallery' ), |
||
338 | 'row_data' => array( |
||
339 | 'data-foogallery-change-selector' => 'input:radio', |
||
340 | 'data-foogallery-hidden' => true, |
||
341 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
342 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
343 | 'data-foogallery-preview' => 'class' |
||
344 | ) |
||
345 | ); |
||
346 | |||
347 | $fields[] = array( |
||
348 | 'id' => 'hover_effect_transition', |
||
349 | 'title' => __( 'Transition', 'foogallery' ), |
||
350 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
351 | 'default' => 'fg-hover-fade', |
||
352 | 'type' => 'select', |
||
353 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_transition_choices', array( |
||
354 | 'fg-hover-instant' => __( 'Instant', 'foogallery' ), |
||
355 | 'fg-hover-fade' => __( 'Fade', 'foogallery' ), |
||
356 | 'fg-hover-slide-up' => __( 'Slide Up', 'foogallery' ), |
||
357 | 'fg-hover-slide-down' => __( 'Slide Down', 'foogallery' ), |
||
358 | 'fg-hover-slide-left' => __( 'Slide Left', 'foogallery' ), |
||
359 | 'fg-hover-slide-right' => __( 'Slide Right', 'foogallery' ), |
||
360 | 'fg-hover-push' => __( 'Push', 'foogallery' ) ) |
||
361 | ), |
||
362 | 'desc' => __( 'Choose what effect is used to show the caption when you hover over a thumbnail', 'foogallery' ), |
||
363 | 'row_data' => array( |
||
364 | 'data-foogallery-change-selector' => 'select', |
||
365 | 'data-foogallery-hidden' => true, |
||
366 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
367 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
368 | 'data-foogallery-preview' => 'class' |
||
369 | ) |
||
370 | ); |
||
371 | |||
372 | $fields[] = array( |
||
373 | 'id' => 'hover_effect_icon', |
||
374 | 'title' => __( 'Icon', 'foogallery' ), |
||
375 | 'desc' => __( 'Choose which icon is shown with the caption when you hover over a thumbnail', 'foogallery' ), |
||
376 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
377 | 'type' => 'htmlicon', |
||
378 | 'default' => 'fg-hover-zoom', |
||
379 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_icon_choices', array( |
||
380 | '' => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon"></div>' ), |
||
381 | 'fg-hover-zoom' => array( 'label' => __( 'Zoom', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom"></div>' ), |
||
382 | 'fg-hover-zoom2' => array( 'label' => __( 'Zoom 2', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom2"></div>' ), |
||
383 | 'fg-hover-zoom3' => array( 'label' => __( 'Zoom 3', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom3"></div>' ), |
||
384 | 'fg-hover-plus' => array( 'label' => __( 'Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-plus"></div>' ), |
||
385 | 'fg-hover-circle-plus' => array( 'label' => __( 'Circle Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-circle-plus"></div>' ), |
||
386 | 'fg-hover-eye' => array( 'label' => __( 'Eye', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-eye"></div>' ), |
||
387 | 'fg-hover-external' => array( 'label' => __( 'External', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-external"></div>' ), ) |
||
388 | ), |
||
389 | 'row_data' => array( |
||
390 | 'data-foogallery-change-selector' => 'input:radio', |
||
391 | 'data-foogallery-hidden' => true, |
||
392 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
393 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
394 | 'data-foogallery-preview' => 'class' |
||
395 | ) |
||
396 | ); |
||
397 | //endregion Hover Effects Fields |
||
398 | |||
399 | //region Caption Fields |
||
400 | $fields[] = array( |
||
401 | 'id' => 'captions_help', |
||
402 | 'title' => __( 'Captions Help', 'foogallery' ), |
||
403 | 'desc' => __( 'You can change when captions are shown using the "Hover Effects -> Caption Visibility" setting .', 'foogallery' ), |
||
404 | 'section' => __( 'Captions', 'foogallery' ), |
||
405 | 'type' => 'help' |
||
406 | ); |
||
407 | |||
408 | $settings_link = sprintf( '<a target="blank" href="%s">%s</a>', foogallery_admin_settings_url(), __( 'settings', 'foogallery' ) ); |
||
409 | |||
410 | $fields[] = array( |
||
411 | 'id' => 'caption_title', |
||
412 | 'title' => __( 'Title', 'foogallery' ), |
||
413 | 'desc' => __( 'Decide where caption titles are pulled from. By default, what is saved under general settings will be used, but it can be overridden per gallery', 'foogallery' ), |
||
414 | 'section' => __( 'Captions', 'foogallery' ), |
||
415 | 'type' => 'radio', |
||
416 | 'default' => '', |
||
417 | 'choices' => array( |
||
418 | 'none' => __( 'None', 'foogallery' ), |
||
419 | '' => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ), |
||
420 | 'title' => foogallery_get_attachment_field_friendly_name( 'title' ), |
||
421 | 'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ), |
||
422 | 'alt' => foogallery_get_attachment_field_friendly_name( 'alt' ), |
||
423 | 'desc' => foogallery_get_attachment_field_friendly_name( 'desc' ), |
||
424 | ), |
||
425 | 'row_data' => array( |
||
426 | 'data-foogallery-change-selector' => 'input:radio', |
||
427 | 'data-foogallery-preview' => 'shortcode' |
||
428 | ) |
||
429 | ); |
||
430 | |||
431 | $fields[] = array( |
||
432 | 'id' => 'caption_desc', |
||
433 | 'title' => __( 'Description', 'foogallery' ), |
||
434 | 'desc' => __( 'Decide where captions descriptions are pulled from. By default, the general settings are used, but it can be overridden per gallery', 'foogallery' ), |
||
435 | 'section' => __( 'Captions', 'foogallery' ), |
||
436 | 'type' => 'radio', |
||
437 | 'default' => '', |
||
438 | 'choices' => array( |
||
439 | 'none' => __( 'None', 'foogallery' ), |
||
440 | '' => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ), |
||
441 | 'title' => foogallery_get_attachment_field_friendly_name( 'title' ), |
||
442 | 'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ), |
||
443 | 'alt' => foogallery_get_attachment_field_friendly_name( 'alt' ), |
||
444 | 'desc' => foogallery_get_attachment_field_friendly_name( 'desc' ), |
||
445 | ), |
||
446 | 'row_data' => array( |
||
447 | 'data-foogallery-change-selector' => 'input:radio', |
||
448 | 'data-foogallery-preview' => 'shortcode' |
||
449 | ) |
||
450 | ); |
||
451 | |||
452 | $fields[] = array( |
||
453 | 'id' => 'captions_limit_length', |
||
454 | 'title' => __( 'Limit Caption Length', 'foogallery' ), |
||
455 | 'desc' => __( 'You can limit the length of caption title and descriptions in the thumbnails. This will NOT limit the length of captions from within the lightbox.', 'foogallery' ), |
||
456 | 'section' => __( 'Captions', 'foogallery' ), |
||
457 | 'default' => '', |
||
458 | 'type' => 'radio', |
||
459 | 'spacer' => '<span class="spacer"></span>', |
||
460 | 'choices' => array( |
||
461 | '' => __( 'No', 'foogallery' ), |
||
462 | 'yes' => __( 'Yes', 'foogallery' ), |
||
463 | ), |
||
464 | 'row_data'=> array( |
||
465 | 'data-foogallery-change-selector' => 'input:radio', |
||
466 | 'data-foogallery-preview' => 'shortcode', |
||
467 | 'data-foogallery-value-selector' => 'input:checked', |
||
468 | ) |
||
469 | ); |
||
470 | |||
471 | $fields[] = array( |
||
472 | 'id' => 'caption_title_length', |
||
473 | 'title' => __( 'Max Title Length', 'foogallery' ), |
||
474 | 'desc' => __( 'A max length of zero will not apply a limit.', 'foogallery '), |
||
475 | 'section' => __( 'Captions', 'foogallery' ), |
||
476 | 'type' => 'number', |
||
477 | 'class' => 'small-text', |
||
478 | 'default' => 0, |
||
479 | 'step' => '1', |
||
480 | 'min' => '0', |
||
481 | 'row_data' => array( |
||
482 | 'data-foogallery-change-selector' => 'input', |
||
483 | 'data-foogallery-hidden' => true, |
||
484 | 'data-foogallery-show-when-field' => 'captions_limit_length', |
||
485 | 'data-foogallery-show-when-field-value' => 'yes', |
||
486 | 'data-foogallery-preview' => 'shortcode' |
||
487 | ) |
||
488 | ); |
||
489 | |||
490 | $fields[] = array( |
||
491 | 'id' => 'caption_desc_length', |
||
492 | 'title' => __( 'Max Desc Length', 'foogallery' ), |
||
493 | 'desc' => __( 'A max length of zero will not apply a limit.', 'foogallery '), |
||
494 | 'section' => __( 'Captions', 'foogallery' ), |
||
495 | 'type' => 'number', |
||
496 | 'class' => 'small-text', |
||
497 | 'default' => 0, |
||
498 | 'step' => '1', |
||
499 | 'min' => '0', |
||
500 | 'row_data' => array( |
||
501 | 'data-foogallery-change-selector' => 'input', |
||
502 | 'data-foogallery-hidden' => true, |
||
503 | 'data-foogallery-show-when-field' => 'captions_limit_length', |
||
504 | 'data-foogallery-show-when-field-value' => 'yes', |
||
505 | 'data-foogallery-preview' => 'shortcode' |
||
506 | ) |
||
507 | ); |
||
508 | //endregion |
||
509 | |||
510 | } |
||
511 | return $fields; |
||
512 | } |
||
513 | |||
630 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.