GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — feature/gallery-template-clien... ( 6aa6f0...0fed14 )
by Brad
02:45
created

FooGallery_Common_Fields   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 470
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 470
rs 10
c 0
b 0
f 0
wmc 12
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
B add_common_fields() 0 406 4
B add_common_fields_class_attributes() 0 34 6
1
<?php
2
/**
3
 * Adds all functionality related to the common gallery fields that are used in the default gallery templates
4
 * Date: 12/09/2017
5
 */
6
if ( ! class_exists( 'FooGallery_Common_Fields' ) ) {
7
8
	class FooGallery_Common_Fields {
9
10
		function __construct() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
11
			//build up class attributes
12
			add_filter( 'foogallery_build_class_attribute', array( $this, 'add_common_fields_class_attributes' ), 10, 2 );
13
14
			if ( is_admin() ) {
15
				//add common fields to the templates that support it
16
				add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_common_fields' ), 10, 2 );
17
			}
18
		}
19
20
		/**
21
		 * Add common fields to the gallery template
22
		 *
23
		 * @param $fields
24
		 * @param $template
25
		 *
26
		 * @return array
27
		 */
28
		function add_common_fields( $fields, $template ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
29
			//check if the template supports the common fields
30
			if ( $template && array_key_exists( 'common_fields_support', $template ) && true === $template['common_fields_support'] ) {
31
32
				//region Appearance Fields
33
				$fields[] = array(
34
					'id'       => 'theme',
35
					'title'    => __( 'Theme', 'foogallery' ),
36
					'desc'     => __( 'The overall appearance of the items in the gallery, affecting the border, background, font and shadow colors.', 'foogallery' ),
37
					'section'  => __( 'Appearance', 'foogallery' ),
38
					'type'     => 'radio',
39
					'default'  => 'fg-light',
40
					'spacer'   => '<span class="spacer"></span>',
41
					'choices'  => array(
42
						'fg-light'  => __( 'Light', 'foogallery' ),
43
						'fg-dark'   => __( 'Dark', 'foogallery' ),
44
						'fg-custom' => __( 'Custom', 'foogallery' )
45
					),
46
					'row_data' => array(
47
						'data-foogallery-change-selector' => 'input:radio',
48
						'data-foogallery-preview'         => 'class'
49
					)
50
				);
51
52
				$fields[] = array(
53
					'id'       => 'border_size',
54
					'title'    => __( 'Border Size', 'foogallery' ),
55
					'desc'     => __( 'The border size applied to each thumbnail', 'foogallery' ),
56
					'section'  => __( 'Appearance', 'foogallery' ),
57
					'type'     => 'radio',
58
					'spacer'   => '<span class="spacer"></span>',
59
					'default'  => 'fg-border-thin',
60
					'choices'  => array(
61
						''                 => __( 'None', 'foogallery' ),
62
						'fg-border-thin'   => __( 'Thin', 'foogallery' ),
63
						'fg-border-medium' => __( 'Medium', 'foogallery' ),
64
						'fg-border-thick'  => __( 'Thick', 'foogallery' ),
65
					),
66
					'row_data' => array(
67
						'data-foogallery-change-selector' => 'input:radio',
68
						'data-foogallery-preview'         => 'class'
69
					)
70
				);
71
72
				$fields[] = array(
73
					'id'       => 'rounded_corners',
74
					'title'    => __( 'Rounded Corners', 'foogallery' ),
75
					'desc'     => __( 'The border radius, or rounded corners applied to each thumbnail', 'foogallery' ),
76
					'section'  => __( 'Appearance', 'foogallery' ),
77
					'type'     => 'radio',
78
					'spacer'   => '<span class="spacer"></span>',
79
					'default'  => '',
80
					'choices'  => array(
81
						''                => __( 'None', 'foogallery' ),
82
						'fg-round-small'  => __( 'Small', 'foogallery' ),
83
						'fg-round-medium' => __( 'Medium', 'foogallery' ),
84
						'fg-round-large'  => __( 'Large', 'foogallery' ),
85
						'fg-round-full'   => __( 'Full', 'foogallery' ),
86
					),
87
					'row_data' => array(
88
						'data-foogallery-change-selector' => 'input:radio',
89
						'data-foogallery-preview'         => 'class'
90
					)
91
				);
92
93
				$fields[] = array(
94
					'id'       => 'drop_shadow',
95
					'title'    => __( 'Drop Shadow', 'foogallery' ),
96
					'desc'     => __( 'The outer or drop shadow applied to each thumbnail', 'foogallery' ),
97
					'section'  => __( 'Appearance', 'foogallery' ),
98
					'type'     => 'radio',
99
					'spacer'   => '<span class="spacer"></span>',
100
					'default'  => 'fg-shadow-outline',
101
					'choices'  => array(
102
						''                  => __( 'None', 'foogallery' ),
103
						'fg-shadow-outline' => __( 'Outline', 'foogallery' ),
104
						'fg-shadow-small'   => __( 'Small', 'foogallery' ),
105
						'fg-shadow-medium'  => __( 'Medium', 'foogallery' ),
106
						'fg-shadow-large'   => __( 'Large', 'foogallery' ),
107
					),
108
					'row_data' => array(
109
						'data-foogallery-change-selector' => 'input:radio',
110
						'data-foogallery-preview'         => 'class'
111
					)
112
				);
113
114
				$fields[] = array(
115
					'id'       => 'inner_shadow',
116
					'title'    => __( 'Inner Shadow', 'foogallery' ),
117
					'desc'     => __( 'The inner shadow applied to each thumbnail', 'foogallery' ),
118
					'section'  => __( 'Appearance', 'foogallery' ),
119
					'type'     => 'radio',
120
					'spacer'   => '<span class="spacer"></span>',
121
					'default'  => '',
122
					'choices'  => array(
123
						''                       => __( 'None', 'foogallery' ),
124
						'fg-shadow-inset-small'  => __( 'Small', 'foogallery' ),
125
						'fg-shadow-inset-medium' => __( 'Medium', 'foogallery' ),
126
						'fg-shadow-inset-large'  => __( 'Large', 'foogallery' ),
127
					),
128
					'row_data' => array(
129
						'data-foogallery-change-selector' => 'input:radio',
130
						'data-foogallery-preview'         => 'class'
131
					)
132
				);
133
134
				$fields[] = array(
135
					'id'       => 'loading_icon',
136
					'title'    => __( 'Loading Icon', 'foogallery' ),
137
					'desc'     => __( 'An animated loading icon can be shown while the thumbnails are busy loading.', 'foogallery' ),
138
					'section'  => __( 'Appearance', 'foogallery' ),
139
					'default'  => 'fg-loading-default',
140
					'type'     => 'htmlicon',
141
					'choices'  => apply_filters(
142
						'foogallery_gallery_template_common_thumbnail_fields_loading_icon_choices', array(
143
						''                   => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon"></div>' ),
144
						'fg-loading-default' => array( 'label' => __( 'Default', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-default"><div class="fg-loader"></div></div>' ),
145
						'fg-loading-bars'    => array( 'label' => __( 'Bars', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-bars"><div class="fg-loader"></div></div>' ),
146
						'fg-loading-dots'    => array( 'label' => __( 'Dots', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-dots"><div class="fg-loader"></div></div>' ),
147
						'fg-loading-partial' => array( 'label' => __( 'Partial', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-partial"><div class="fg-loader"></div></div>' ),
148
						'fg-loading-pulse'   => array( 'label' => __( 'Pulse', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-pulse"><div class="fg-loader"></div></div>' ),
149
						'fg-loading-trail'   => array( 'label' => __( 'Trail', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-trail"><div class="fg-loader"></div></div>' ),
150
					)
151
					),
152
					'row_data' => array(
153
						'data-foogallery-change-selector' => 'input:radio',
154
						'data-foogallery-preview'         => 'class'
155
					)
156
				);
157
158
				$fields[] = array(
159
					'id'       => 'loaded_effect',
160
					'title'    => __( 'Loaded Effect', 'foogallery' ),
161
					'desc'     => __( 'The animation effect used to display the thumbnail, once it has loaded.', 'foogallery' ),
162
					'section'  => __( 'Appearance', 'foogallery' ),
163
					'default'  => 'fg-loaded-fade-in',
164
					'type'     => 'select',
165
					'choices'  => apply_filters(
166
						'foogallery_gallery_template_common_thumbnail_fields_loaded_effect_choices', array(
167
						''                      => __( 'None', 'foogallery' ),
168
						'fg-loaded-fade-in'     => __( 'Fade In', 'foogallery' ),
169
						'fg-loaded-slide-up'    => __( 'Slide Up', 'foogallery' ),
170
						'fg-loaded-slide-down'  => __( 'Slide Down', 'foogallery' ),
171
						'fg-loaded-slide-left'  => __( 'Slide Left', 'foogallery' ),
172
						'fg-loaded-slide-right' => __( 'Slide Right', 'foogallery' ),
173
						'fg-loaded-scale-up'    => __( 'Scale Up', 'foogallery' ),
174
						'fg-loaded-swing-down'  => __( 'Swing Down', 'foogallery' ),
175
						'fg-loaded-drop'        => __( 'Drop', 'foogallery' ),
176
						'fg-loaded-fly'         => __( 'Fly', 'foogallery' ),
177
						'fg-loaded-flip'        => __( 'Flip', 'foogallery' ),
178
					)
179
					),
180
					'row_data' => array(
181
						'data-foogallery-change-selector' => 'input:radio',
182
						'data-foogallery-preview'         => 'class'
183
					)
184
				);
185
				//endregion
186
187
				//region Hover Effects Fields
188
				$fields[] = array(
189
					'id'      => 'hover_effect_help',
190
					'title'   => __( 'Hover Effect Help', 'foogallery' ),
191
					'desc'    => __( 'A preset provides a stylish and pre-defined look &amp; feel for when you hover over the thumbnails.', 'foogallery' ),
192
					'section' => __( 'Hover Effects', 'foogallery' ),
193
					'type'    => 'help'
194
				);
195
196
				$fields[] = array(
197
					'id'       => 'hover_effect_preset',
198
					'title'    => __( 'Preset', 'foogallery' ),
199
					'section'  => __( 'Hover Effects', 'foogallery' ),
200
					'default'  => 'fg-custom',
201
					'type'     => 'radio',
202
					'choices'  => apply_filters(
203
						'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_choices', array(
204
						''                     => __( 'None', 'foogallery' ),
205
						'fg-preset fg-sadie'   => __( 'Sadie', 'foogallery' ),
206
						'fg-preset fg-layla'   => __( 'Layla', 'foogallery' ),
207
						'fg-preset fg-oscar'   => __( 'Oscar', 'foogallery' ),
208
						'fg-preset fg-sarah'   => __( 'Sarah', 'foogallery' ),
209
						'fg-preset fg-goliath' => __( 'Goliath', 'foogallery' ),
210
						'fg-preset fg-jazz'    => __( 'Jazz', 'foogallery' ),
211
						'fg-preset fg-lily'    => __( 'Lily', 'foogallery' ),
212
						'fg-preset fg-ming'    => __( 'Ming', 'foogallery' ),
213
						'fg-preset fg-selena'  => __( 'Selena', 'foogallery' ),
214
						'fg-preset fg-steve'   => __( 'Steve', 'foogallery' ),
215
						'fg-preset fg-zoe'     => __( 'Zoe', 'foogallery' ),
216
217
						'fg-custom' => __( 'Custom', 'foogallery' ),
218
					)
219
					),
220
					'spacer'   => '<span class="spacer"></span>',
221
					'desc'     => __( 'A preset styling that is used for the captions. If you want to define your own custom captions, then choose Custom.', 'foogallery' ),
222
					'row_data' => array(
223
						'data-foogallery-change-selector' => 'input:radio',
224
						'data-foogallery-value-selector'  => 'input:checked',
225
						'data-foogallery-preview'         => 'class'
226
					)
227
				);
228
229
				$fields[] = array(
230
					'id'       => 'hover_effect_preset_size',
231
					'title'    => __( 'Preset Size', 'foogallery' ),
232
					'section'  => __( 'Hover Effects', 'foogallery' ),
233
					'default'  => 'fg-preset-small',
234
					'spacer'   => '<span class="spacer"></span>',
235
					'type'     => 'radio',
236
					'choices'  => apply_filters(
237
						'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_size_choices', array(
238
						'fg-preset-small'  => __( 'Small', 'foogallery' ),
239
						'fg-preset-medium' => __( 'Medium', 'foogallery' ),
240
						'fg-preset-large'  => __( 'Large', 'foogallery' ),
241
					)
242
					),
243
					'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' ),
244
					'row_data' => array(
245
						'data-foogallery-change-selector'          => 'input:radio',
246
						'data-foogallery-hidden'                   => true,
247
						'data-foogallery-show-when-field'          => 'hover_effect_preset',
248
						'data-foogallery-show-when-field-operator' => 'indexOf',
249
						'data-foogallery-show-when-field-value'    => 'fg-preset',
250
						'data-foogallery-preview'                  => 'class'
251
					)
252
				);
253
254
				$fields[] = array(
255
					'id'       => 'hover_effect_color',
256
					'title'    => __( 'Color Effect', 'foogallery' ),
257
					'section'  => __( 'Hover Effects', 'foogallery' ),
258
					'default'  => '',
259
					'spacer'   => '<span class="spacer"></span>',
260
					'type'     => 'radio',
261
					'choices'  => apply_filters(
262
						'foogallery_gallery_template_common_thumbnail_fields_hover_effect_color_choices', array(
263
						''                   => __( 'None', 'foogallery' ),
264
						'fg-hover-colorize'  => __( 'Colorize', 'foogallery' ),
265
						'fg-hover-grayscale' => __( 'Greyscale', 'foogallery' ),
266
					)
267
					),
268
					'desc'     => __( 'Choose an color effect that is applied when you hover over a thumbnail.', 'foogallery' ),
269
					'row_data' => array(
270
						'data-foogallery-change-selector'       => 'input:radio',
271
						'data-foogallery-hidden'                => true,
272
						'data-foogallery-show-when-field'       => 'hover_effect_preset',
273
						'data-foogallery-show-when-field-value' => 'fg-custom',
274
						'data-foogallery-preview'               => 'class'
275
					)
276
				);
277
278
				$fields[] = array(
279
					'id'       => 'hover_effect_scale',
280
					'title'    => __( 'Scaling Effect', 'foogallery' ),
281
					'section'  => __( 'Hover Effects', 'foogallery' ),
282
					'default'  => '',
283
					'spacer'   => '<span class="spacer"></span>',
284
					'type'     => 'radio',
285
					'choices'  => apply_filters(
286
						'foogallery_gallery_template_common_thumbnail_fields_hover_effect_scale_choices', array(
287
						''               => __( 'None', 'foogallery' ),
288
						'fg-hover-scale' => __( 'Scaled', 'foogallery' ),
289
					)
290
					),
291
					'desc'     => __( 'Apply a slight scaling effect when hovering over a thumbnail.', 'foogallery' ),
292
					'row_data' => array(
293
						'data-foogallery-change-selector'       => 'input:radio',
294
						'data-foogallery-hidden'                => true,
295
						'data-foogallery-show-when-field'       => 'hover_effect_preset',
296
						'data-foogallery-show-when-field-value' => 'fg-custom',
297
						'data-foogallery-preview'               => 'class'
298
					)
299
				);
300
301
				$fields[] = array(
302
					'id'       => 'hover_effect_caption_visibility',
303
					'title'    => __( 'Caption Visibility', 'foogallery' ),
304
					'section'  => __( 'Hover Effects', 'foogallery' ),
305
					'default'  => 'fg-caption-hover',
306
					'spacer'   => '<span class="spacer"></span>',
307
					'type'     => 'radio',
308
					'choices'  => apply_filters(
309
						'foogallery_gallery_template_common_thumbnail_fields_hover_effect_caption_visibility_choices', array(
310
						''                  => __( 'None', 'foogallery' ),
311
						'fg-caption-hover'  => __( 'On Hover', 'foogallery' ),
312
						'fg-caption-always' => __( 'Always Visible', 'foogallery' ),
313
					)
314
					),
315
					'desc'     => __( 'Choose how the captions will be displayed.', 'foogallery' ),
316
					'row_data' => array(
317
						'data-foogallery-change-selector'       => 'input:radio',
318
						'data-foogallery-hidden'                => true,
319
						'data-foogallery-show-when-field'       => 'hover_effect_preset',
320
						'data-foogallery-show-when-field-value' => 'fg-custom',
321
						'data-foogallery-preview'               => 'class'
322
					)
323
				);
324
325
				$fields[] = array(
326
					'id'       => 'hover_effect_transition',
327
					'title'    => __( 'Transition', 'foogallery' ),
328
					'section'  => __( 'Hover Effects', 'foogallery' ),
329
					'default'  => 'fg-hover-fade',
330
					'type'     => 'select',
331
					'choices'  => apply_filters(
332
						'foogallery_gallery_template_common_thumbnail_fields_hover_effect_transition_choices', array(
333
						'fg-hover-instant'     => __( 'Instant', 'foogallery' ),
334
						'fg-hover-fade'        => __( 'Fade', 'foogallery' ),
335
						'fg-hover-slide-up'    => __( 'Slide Up', 'foogallery' ),
336
						'fg-hover-slide-down'  => __( 'Slide Down', 'foogallery' ),
337
						'fg-hover-slide-left'  => __( 'Slide Left', 'foogallery' ),
338
						'fg-hover-slide-right' => __( 'Slide Right', 'foogallery' ),
339
						'fg-hover-push'        => __( 'Push', 'foogallery' )
340
					)
341
					),
342
					'desc'     => __( 'Choose what effect is used to show the caption when you hover over a thumbnail', 'foogallery' ),
343
					'row_data' => array(
344
						'data-foogallery-change-selector'       => 'select',
345
						'data-foogallery-hidden'                => true,
346
						'data-foogallery-show-when-field'       => 'hover_effect_preset',
347
						'data-foogallery-show-when-field-value' => 'fg-custom',
348
						'data-foogallery-preview'               => 'class'
349
					)
350
				);
351
352
				$fields[] = array(
353
					'id'       => 'hover_effect_icon',
354
					'title'    => __( 'Icon', 'foogallery' ),
355
					'desc'     => __( 'Choose which icon is shown with the caption when you hover over a thumbnail', 'foogallery' ),
356
					'section'  => __( 'Hover Effects', 'foogallery' ),
357
					'type'     => 'htmlicon',
358
					'default'  => 'fg-hover-zoom',
359
					'choices'  => apply_filters(
360
						'foogallery_gallery_template_common_thumbnail_fields_hover_effect_icon_choices', array(
361
						''                     => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon"></div>' ),
362
						'fg-hover-zoom'        => array( 'label' => __( 'Zoom', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom"></div>' ),
363
						'fg-hover-zoom2'       => array( 'label' => __( 'Zoom 2', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom2"></div>' ),
364
						'fg-hover-zoom3'       => array( 'label' => __( 'Zoom 3', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom3"></div>' ),
365
						'fg-hover-plus'        => array( 'label' => __( 'Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-plus"></div>' ),
366
						'fg-hover-circle-plus' => array( 'label' => __( 'Circle Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-circle-plus"></div>' ),
367
						'fg-hover-eye'         => array( 'label' => __( 'Eye', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-eye"></div>' ),
368
						'fg-hover-external'    => array( 'label' => __( 'External', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-external"></div>' ),
369
					)
370
					),
371
					'row_data' => array(
372
						'data-foogallery-change-selector'       => 'input:radio',
373
						'data-foogallery-hidden'                => true,
374
						'data-foogallery-show-when-field'       => 'hover_effect_preset',
375
						'data-foogallery-show-when-field-value' => 'fg-custom',
376
						'data-foogallery-preview'               => 'class'
377
					)
378
				);
379
380
				$settings_link = sprintf( '<a target="blank" href="%s">%s</a>', foogallery_admin_settings_url(), __( 'settings', 'foogallery' ) );
381
382
				$fields[] = array(
383
					'id'       => 'hover_effect_title',
384
					'title'    => __( 'Title', 'foogallery' ),
385
					'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' ),
386
					'section'  => __( 'Hover Effects', 'foogallery' ),
387
					'type'     => 'radio',
388
					'default'  => '',
389
					'choices'  => array(
390
						'none'    => __( 'None', 'foogallery' ),
391
						''        => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ),
392
						'title'   => foogallery_get_attachment_field_friendly_name( 'title' ),
393
						'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ),
394
						'alt'     => foogallery_get_attachment_field_friendly_name( 'alt' ),
395
						'desc'    => foogallery_get_attachment_field_friendly_name( 'desc' ),
396
					),
397
					'row_data' => array(
398
						'data-foogallery-change-selector'       => 'input:radio',
399
						'data-foogallery-hidden'                => true,
400
						'data-foogallery-show-when-field'       => 'hover_effect_preset',
401
						'data-foogallery-show-when-field-value' => 'fg-custom',
402
						'data-foogallery-preview'               => 'shortcode'
403
					)
404
				);
405
406
				$fields[] = array(
407
					'id'       => 'hover_effect_desc',
408
					'title'    => __( 'Description', 'foogallery' ),
409
					'desc'     => __( 'Decide where captions descriptions are pulled from. By default, the general settings are used, but it can be overridden per gallery', 'foogallery' ),
410
					'section'  => __( 'Hover Effects', 'foogallery' ),
411
					'type'     => 'radio',
412
					'default'  => '',
413
					'choices'  => array(
414
						'none'    => __( 'None', 'foogallery' ),
415
						''        => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ),
416
						'title'   => foogallery_get_attachment_field_friendly_name( 'title' ),
417
						'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ),
418
						'alt'     => foogallery_get_attachment_field_friendly_name( 'alt' ),
419
						'desc'    => foogallery_get_attachment_field_friendly_name( 'desc' ),
420
					),
421
					'row_data' => array(
422
						'data-foogallery-change-selector'       => 'input:radio',
423
						'data-foogallery-hidden'                => true,
424
						'data-foogallery-show-when-field'       => 'hover_effect_preset',
425
						'data-foogallery-show-when-field-value' => 'fg-custom',
426
						'data-foogallery-preview'               => 'shortcode'
427
					)
428
				);
429
				//endregion Hover Effects Fields
430
431
			}
432
			return $fields;
433
		}
434
435
		/**
436
		 * Build up the gallery class attribute for the common fields
437
		 *
438
		 * @param $classes array
439
		 * @param $gallery FooGallery
440
		 *
441
		 * @return array
442
		 */
443
		function add_common_fields_class_attributes( $classes, $gallery ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
444
			$template_data = foogallery_get_gallery_template( $gallery->gallery_template );
445
446
			//check the template supports paging
447
			if ( $template_data && array_key_exists( 'common_fields_support', $template_data ) && true === $template_data['common_fields_support'] ) {
448
449
				//get some default classes from common gallery settings
450
				$classes[] = $gallery->get_setting( 'theme', 'fg-light' );
451
				$classes[] = $gallery->get_setting( 'border_size', 'fg-border-thin' );
452
				$classes[] = $gallery->get_setting( 'rounded_corners', '' );
453
				$classes[] = $gallery->get_setting( 'drop_shadow', 'fg-shadow-outline' );
454
				$classes[] = $gallery->get_setting( 'inner_shadow', '' );
455
				$classes[] = $gallery->get_setting( 'loading_icon', 'fg-loading-default' );
456
				$classes[] = $gallery->get_setting( 'loaded_effect', 'fg-loaded-fade-in' );
457
458
				$caption_preset = $gallery->get_setting( 'hover_effect_preset', 'fg-custom' );
459
460
				$classes[] = $caption_preset;
461
462
				if ( 'fg-custom' === $caption_preset ) {
463
					//only set these caption classes if custom preset is selected
464
					$classes[] = $gallery->get_setting( 'hover_effect_color', '' );
465
					$classes[] = $gallery->get_setting( 'hover_effect_scale', '' );
466
					$classes[] = $gallery->get_setting( 'hover_effect_caption_visibility', 'fg-caption-hover' );
467
					$classes[] = $gallery->get_setting( 'hover_effect_transition', 'fg-hover-fade' );
468
					$classes[] = $gallery->get_setting( 'hover_effect_icon', 'fg-hover-zoom' );
469
				} else if ( strpos( $caption_preset, 'fg-preset' ) !== false ) {
470
					//set a preset size
471
					$classes[] = $gallery->get_setting( 'hover_effect_preset_size', 'fg-preset-small' );
472
				}
473
			}
474
475
			return $classes;
476
		}
477
	}
478
}