abilities
3 days ago
admin
3 days ago
compatibility
3 days ago
extensions
3 days ago
foopluginbase
3 days ago
public
3 days ago
thumbs
3 days ago
asset-manifest.php
3 days ago
class-attachment-filters.php
3 days ago
class-command-palette.php
3 days ago
class-foogallery-animated-gif-support.php
3 days ago
class-foogallery-attachment-custom-class.php
3 days ago
class-foogallery-attachment-filename.php
3 days ago
class-foogallery-attachment-type.php
3 days ago
class-foogallery-attachment.php
3 days ago
class-foogallery-cache.php
3 days ago
class-foogallery-common-fields.php
3 days ago
class-foogallery-crop-position.php
3 days ago
class-foogallery-datasource-media_library.php
3 days ago
class-foogallery-debug.php
3 days ago
class-foogallery-delayed-runtime-loader.php
3 days ago
class-foogallery-extensions-compatibility.php
3 days ago
class-foogallery-force-https.php
3 days ago
class-foogallery-lazyload.php
3 days ago
class-foogallery-license-constant-handler.php
3 days ago
class-foogallery-lightbox.php
3 days ago
class-foogallery-no-javascript-fallback.php
3 days ago
class-foogallery-paging.php
3 days ago
class-foogallery-password-protect.php
3 days ago
class-foogallery-sitemaps.php
3 days ago
class-foogallery-widget.php
3 days ago
class-foogallery.php
3 days ago
class-gallery-advanced-settings.php
3 days ago
class-il8n.php
3 days ago
class-override-thumbnail.php
3 days ago
class-posttypes.php
3 days ago
class-previews.php
3 days ago
class-retina.php
3 days ago
class-thumbnail-dimensions.php
3 days ago
class-thumbnails.php
3 days ago
class-version-check.php
3 days ago
constants.php
3 days ago
functions.php
3 days ago
gallery-management-functions.php
3 days ago
includes.php
3 days ago
index.php
3 days ago
render-functions.php
3 days ago
class-foogallery-lightbox.php
1290 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | /** |
| 8 | * FooGallery Lightbox class |
| 9 | * |
| 10 | * @package FooGallery |
| 11 | */ |
| 12 | |
| 13 | if ( ! class_exists( 'FooGallery_Lightbox' ) ) { |
| 14 | |
| 15 | /** |
| 16 | * FooGallery Lightbox class |
| 17 | */ |
| 18 | class FooGallery_Lightbox { |
| 19 | /** |
| 20 | * Constructor method. |
| 21 | * Initializes the FooGallery Lightbox class and adds necessary filters. |
| 22 | */ |
| 23 | public function __construct() { |
| 24 | // add lightbox custom fields. |
| 25 | add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'lightbox_custom_fields' ), 10, 2 ); |
| 26 | |
| 27 | // add the data options needed for lightbox. |
| 28 | add_filter( 'foogallery_build_container_data_options', array( $this, 'add_data_options' ), 10, 3 ); |
| 29 | |
| 30 | // set the settings icon for lightbox. |
| 31 | add_filter( 'foogallery_gallery_settings_metabox_section_icon', array( $this, 'add_section_icons' ) ); |
| 32 | |
| 33 | // add the FooGallery lightbox option. |
| 34 | add_filter( 'foogallery_gallery_template_field_lightboxes', array( $this, 'add_lightbox' ) ); |
| 35 | |
| 36 | // alter the default lightbox to be FooGallery Lightbox. |
| 37 | add_filter( 'foogallery_alter_gallery_template_field', array( $this, 'make_foogallery_default_lightbox' ), 99, 2 ); |
| 38 | |
| 39 | // add specific lightbox data attribute to the container div. |
| 40 | add_filter( 'foogallery_build_container_attributes', array( $this, 'add_lightbox_data_attributes' ), 10, 2 ); |
| 41 | |
| 42 | // remove PRO lightbox option from albums. |
| 43 | add_filter( 'foogallery_alter_gallery_template_field', array( $this, 'alter_gallery_template_field' ), 999, 2 ); |
| 44 | |
| 45 | // cater for different captions sources. |
| 46 | add_filter( 'foogallery_attachment_html_link_attributes', array( $this, 'add_caption_attributes' ), 10, 3 ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Handle custom captions for the lightbox |
| 51 | * |
| 52 | * @param array $attr The HTML attributes for the attachment link. |
| 53 | * @param array $args An array of arguments. |
| 54 | * @param object $foogallery_attachment The FooGallery attachment object. |
| 55 | * |
| 56 | * @return array The modified HTML attributes. |
| 57 | */ |
| 58 | public function add_caption_attributes( $attr, $args, $foogallery_attachment ) { |
| 59 | global $current_foogallery; |
| 60 | |
| 61 | // Attribute helpers can be used outside a gallery render context by integrations and tests. |
| 62 | if ( ! is_object( $current_foogallery ) ) { |
| 63 | return $attr; |
| 64 | } |
| 65 | |
| 66 | if ( ! property_exists( $current_foogallery, 'lightbox' ) ) { |
| 67 | // TODO : rather use foogallery_current_gallery_check_template_has_supported_feature. |
| 68 | $template = foogallery_get_gallery_template( $current_foogallery->gallery_template ); |
| 69 | $lightbox = foogallery_gallery_template_setting_lightbox(); |
| 70 | if ( $template && isset( $template['panel_support'] ) && $template['panel_support'] ) { |
| 71 | $lightbox = 'foogallery'; |
| 72 | } |
| 73 | $current_foogallery->lightbox = $lightbox; |
| 74 | } |
| 75 | |
| 76 | // check if lightbox set to foogallery. |
| 77 | if ( 'foogallery' === $current_foogallery->lightbox ) { |
| 78 | |
| 79 | // check lightbox caption source. |
| 80 | $source = foogallery_gallery_template_setting( 'lightbox_caption_override', '' ); |
| 81 | |
| 82 | if ( 'override' === $source ) { |
| 83 | $caption_title_source = foogallery_gallery_template_setting( 'lightbox_caption_override_title', '' ); |
| 84 | if ( '' === $caption_title_source ) { |
| 85 | if ( array_key_exists( 'data-caption-title', $attr ) ) { |
| 86 | $attr['data-lightbox-title'] = $attr['data-caption-title']; |
| 87 | } |
| 88 | } else if ( 'none' === $caption_title_source ) { |
| 89 | $attr['data-lightbox-title'] = ''; |
| 90 | } else { |
| 91 | $attr['data-lightbox-title'] = foogallery_get_caption_by_source( $foogallery_attachment, $caption_title_source, 'title' ); |
| 92 | } |
| 93 | |
| 94 | $caption_desc_source = foogallery_gallery_template_setting( 'lightbox_caption_override_desc', '' ); |
| 95 | if ( '' === $caption_desc_source ) { |
| 96 | if ( array_key_exists( 'data-caption-desc', $attr ) ) { |
| 97 | $attr['data-lightbox-description'] = $attr['data-caption-desc']; |
| 98 | } |
| 99 | } else if ( 'none' === $caption_desc_source ) { |
| 100 | $attr['data-lightbox-description'] = ''; |
| 101 | } else { |
| 102 | $attr['data-lightbox-description'] = foogallery_get_caption_by_source( $foogallery_attachment, $caption_desc_source, 'description' ); |
| 103 | } |
| 104 | } else if ( 'custom' === $source ) { |
| 105 | |
| 106 | $template = foogallery_gallery_template_setting( 'lightbox_caption_custom_template', '' ); |
| 107 | if ( ! empty( $template ) ) { |
| 108 | $attr['data-lightbox-description'] = FooGallery_Pro_Advanced_Captions::build_custom_caption( $template, $foogallery_attachment ); |
| 109 | } |
| 110 | } else if ( '' === $source ) { |
| 111 | // if same as thumbnails, then check if custom captions was set. |
| 112 | if ( isset( $foogallery_attachment->custom_captions ) && $foogallery_attachment->custom_captions ) { |
| 113 | $attr['data-lightbox-title'] = ''; |
| 114 | $attr['data-lightbox-description'] = $foogallery_attachment->caption_desc; |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | // Make sure the captions are sanitized!! |
| 120 | if ( isset( $attr['data-lightbox-title'] ) ) { |
| 121 | $attr['data-lightbox-title'] = foogallery_sanitize_full( $attr['data-lightbox-title'] ); |
| 122 | } |
| 123 | |
| 124 | if ( isset( $attr['data-lightbox-description'] ) ) { |
| 125 | $attr['data-lightbox-description'] = foogallery_sanitize_full( $attr['data-lightbox-description'] ); |
| 126 | } |
| 127 | |
| 128 | return $attr; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Add fields to all galleries. |
| 133 | * |
| 134 | * @param $fields |
| 135 | * @param $template |
| 136 | * |
| 137 | * @return mixed |
| 138 | * @uses "foogallery_override_gallery_template_fields" |
| 139 | * |
| 140 | */ |
| 141 | public function lightbox_custom_fields( $fields, $template ) { |
| 142 | $use_lightbox = true; |
| 143 | if ( $template && array_key_exists( 'panel_support', $template ) && true === $template['panel_support'] ) { |
| 144 | $use_lightbox = false; |
| 145 | } |
| 146 | |
| 147 | $section_id = $use_lightbox ? 'lightbox' : 'panel'; |
| 148 | |
| 149 | if ( $use_lightbox ) { |
| 150 | if ( foogallery_admin_fields_has_field( $fields, 'thumbnail_link' ) && |
| 151 | foogallery_admin_fields_has_field( $fields, 'lightbox' ) && |
| 152 | !foogallery_admin_fields_has_field( $fields, 'lightbox_warning' ) ) { |
| 153 | |
| 154 | $warning_field = array( |
| 155 | array( |
| 156 | 'id' => 'lightbox_warning', |
| 157 | 'title' => __('Your Lightbox Will Not Work!', 'foogallery'), |
| 158 | 'desc' => __('No lightbox will be shown, because under the General tab, you have set the Thumbnail Link to "Not linked".', 'foogallery'), |
| 159 | 'section_id' => 'lightbox', |
| 160 | 'subsection_id' => 'lightbox-general', |
| 161 | 'type' => 'help', |
| 162 | 'row_data' => array( |
| 163 | 'data-foogallery-hidden' => true, |
| 164 | 'data-foogallery-show-when-field' => 'thumbnail_link', |
| 165 | 'data-foogallery-show-when-field-operator' => '===', |
| 166 | 'data-foogallery-show-when-field-value' => 'none', |
| 167 | ), |
| 168 | ) |
| 169 | ); |
| 170 | |
| 171 | $index = foogallery_admin_fields_find_index_of_field( $fields, 'lightbox' ); |
| 172 | |
| 173 | array_splice( $fields, $index, 0, $warning_field ); |
| 174 | } |
| 175 | |
| 176 | $field[] = array( |
| 177 | 'id' => 'lightbox_promo', |
| 178 | 'title' => __('Your Gallery Needs A Lightbox!', 'foogallery'), |
| 179 | 'desc' => __('Website visitors prefer a gallery with a lightbox. A lightbox allows you to showcase your images, as well as improve navigation between images in your gallery.', 'foogallery'), |
| 180 | 'section_id' => $section_id, |
| 181 | 'subsection_id' => 'lightbox-general', |
| 182 | 'type' => 'help', |
| 183 | 'row_data' => array( |
| 184 | 'data-foogallery-hidden' => true, |
| 185 | 'data-foogallery-show-when-field' => 'lightbox', |
| 186 | 'data-foogallery-show-when-field-operator' => '===', |
| 187 | 'data-foogallery-show-when-field-value' => 'none', |
| 188 | ), |
| 189 | ); |
| 190 | } |
| 191 | |
| 192 | $field[] = array( |
| 193 | 'id' => 'lightbox_theme', |
| 194 | 'title' => __( 'Theme', 'foogallery' ), |
| 195 | 'desc' => __( 'The overall appearance including background and button color. By default it will inherit from Appearance -> Theme', 'foogallery' ), |
| 196 | 'section_id' => $section_id, |
| 197 | 'subsection_id' => 'lightbox-general', |
| 198 | 'type' => 'radio', |
| 199 | 'default' => '', |
| 200 | 'choices' => apply_filters( |
| 201 | 'foogallery_gallery_template_lightbox_theme_choices', |
| 202 | array( |
| 203 | '' => __( 'Inherit', 'foogallery' ), |
| 204 | 'fg-light' => __( 'Light', 'foogallery' ), |
| 205 | 'fg-dark' => __( 'Dark', 'foogallery' ), |
| 206 | 'fg-custom' => __( 'Custom', 'foogallery' ), |
| 207 | ) |
| 208 | ), |
| 209 | 'row_data' => array( |
| 210 | 'data-foogallery-change-selector' => 'input', |
| 211 | 'data-foogallery-preview' => 'shortcode', |
| 212 | 'data-foogallery-value-selector' => 'input:checked', |
| 213 | 'data-foogallery-hidden' => true, |
| 214 | 'data-foogallery-show-when-field' => 'lightbox', |
| 215 | 'data-foogallery-show-when-field-operator' => '===', |
| 216 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 217 | ) |
| 218 | ); |
| 219 | |
| 220 | if ( $use_lightbox ) { |
| 221 | $field[] = array( |
| 222 | 'id' => 'lightbox_help_controls', |
| 223 | 'title' => __( 'Lightbox Control Settings', 'foogallery' ), |
| 224 | 'desc' => __( 'The Lightbox Controls are the action buttons that are shown within the lightbox, e.g. the Close button or the Navigation buttons', 'foogallery' ), |
| 225 | 'section_id' => $section_id, |
| 226 | 'subsection_id' => 'lightbox-controls', |
| 227 | 'type' => 'help', |
| 228 | 'row_data' => array( |
| 229 | 'data-foogallery-hidden' => true, |
| 230 | 'data-foogallery-show-when-field' => 'lightbox', |
| 231 | 'data-foogallery-show-when-field-operator' => '===', |
| 232 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 233 | ), |
| 234 | ); |
| 235 | } |
| 236 | |
| 237 | $field[] = array( |
| 238 | 'id' => 'lightbox_button_theme', |
| 239 | 'title' => __( 'Control Color', 'foogallery' ), |
| 240 | 'desc' => __( 'You can override the button controls color. By default it will inherit from the theme.', 'foogallery' ), |
| 241 | 'section_id' => $section_id, |
| 242 | 'subsection_id' => 'lightbox-controls', |
| 243 | 'type' => 'radio', |
| 244 | 'default' => '', |
| 245 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_button_theme_choices', array( |
| 246 | '' => __( 'Same As Theme', 'foogallery' ), |
| 247 | 'custom' => __( 'Custom Color', 'foogallery' ), |
| 248 | ) ), |
| 249 | 'row_data'=> array( |
| 250 | 'data-foogallery-change-selector' => 'input', |
| 251 | 'data-foogallery-preview' => 'shortcode', |
| 252 | 'data-foogallery-value-selector' => 'input:checked', |
| 253 | 'data-foogallery-hidden' => true, |
| 254 | 'data-foogallery-show-when-field' => 'lightbox', |
| 255 | 'data-foogallery-show-when-field-operator' => '===', |
| 256 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 257 | ), |
| 258 | ); |
| 259 | |
| 260 | $field[] = array( |
| 261 | 'id' => 'lightbox_custom_button_theme', |
| 262 | 'title' => __( 'Custom Control Color', 'foogallery' ), |
| 263 | 'desc' => __( 'You can override the button controls color by selecting a color.', 'foogallery' ), |
| 264 | 'section_id' => $section_id, |
| 265 | 'subsection_id' => 'lightbox-controls', |
| 266 | 'spacer' => '<span class="spacer"></span>', |
| 267 | 'type' => 'htmlicon', |
| 268 | 'default' => 'fg-button-light', |
| 269 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_custom_button_theme_choices', array( |
| 270 | 'fg-button-light' => array( 'label' => __( 'Light', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-light"></div>' ), |
| 271 | 'fg-button-dark' => array( 'label' => __( 'Dark', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-dark"></div>' ), |
| 272 | 'fg-button-blue' => array( 'label' => __( 'Blue', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-blue"></div>' ), |
| 273 | 'fg-button-purple' => array( 'label' => __( 'Purple', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-purple"></div>' ), |
| 274 | 'fg-button-green' => array( 'label' => __( 'Green', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-green"></div>' ), |
| 275 | 'fg-button-red' => array( 'label' => __( 'Red', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-red"></div>' ), |
| 276 | 'fg-button-orange' => array( 'label' => __( 'Orange', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-orange"></div>' ), |
| 277 | ) ), |
| 278 | 'row_data'=> array( |
| 279 | 'data-foogallery-change-selector' => 'input', |
| 280 | 'data-foogallery-preview' => 'shortcode', |
| 281 | 'data-foogallery-value-selector' => 'input:checked', |
| 282 | 'data-foogallery-hidden' => true, |
| 283 | 'data-foogallery-show-when-field' => 'lightbox_button_theme', |
| 284 | 'data-foogallery-show-when-field-operator' => '===', |
| 285 | 'data-foogallery-show-when-field-value' => 'custom', |
| 286 | ), |
| 287 | ); |
| 288 | |
| 289 | $field[] = array( |
| 290 | 'id' => 'lightbox_button_highlight', |
| 291 | 'title' => __( 'Control Hover Color', 'foogallery' ), |
| 292 | 'desc' => __( 'You can override the button controls hover color. By default it will inherit from the theme.', 'foogallery' ), |
| 293 | 'section_id' => $section_id, |
| 294 | 'subsection_id' => 'lightbox-controls', |
| 295 | 'type' => 'radio', |
| 296 | 'default' => '', |
| 297 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_button_highlight_choices', array( |
| 298 | '' => __( 'Same As Theme', 'foogallery' ), |
| 299 | 'custom' => __( 'Custom Color', 'foogallery' ), |
| 300 | ) ), |
| 301 | 'row_data'=> array( |
| 302 | 'data-foogallery-change-selector' => 'input', |
| 303 | 'data-foogallery-preview' => 'shortcode', |
| 304 | 'data-foogallery-value-selector' => 'input:checked', |
| 305 | 'data-foogallery-hidden' => true, |
| 306 | 'data-foogallery-show-when-field' => 'lightbox', |
| 307 | 'data-foogallery-show-when-field-operator' => '===', |
| 308 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 309 | ), |
| 310 | ); |
| 311 | |
| 312 | $field[] = array( |
| 313 | 'id' => 'lightbox_custom_button_highlight', |
| 314 | 'title' => __( 'Custom Control Hover Color', 'foogallery' ), |
| 315 | 'desc' => __( 'You can override the button controls hover color by selecting a color.', 'foogallery' ), |
| 316 | 'section_id' => $section_id, |
| 317 | 'subsection_id' => 'lightbox-controls', |
| 318 | 'spacer' => '<span class="spacer"></span>', |
| 319 | 'type' => 'htmlicon', |
| 320 | 'default' => 'fg-highlight-light', |
| 321 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_custom_button_highlight_choices', array( |
| 322 | 'fg-highlight-light' => array( 'label' => __( 'Light', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-light"></div>' ), |
| 323 | 'fg-highlight-dark' => array( 'label' => __( 'Dark', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-dark"></div>' ), |
| 324 | 'fg-highlight-blue' => array( 'label' => __( 'Blue', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-blue"></div>' ), |
| 325 | 'fg-highlight-purple' => array( 'label' => __( 'Purple', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-purple"></div>' ), |
| 326 | 'fg-highlight-green' => array( 'label' => __( 'Green', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-green"></div>' ), |
| 327 | 'fg-highlight-red' => array( 'label' => __( 'Red', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-red"></div>' ), |
| 328 | 'fg-highlight-orange' => array( 'label' => __( 'Orange', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-orange"></div>' ), |
| 329 | ) ), |
| 330 | 'row_data'=> array( |
| 331 | 'data-foogallery-change-selector' => 'input', |
| 332 | 'data-foogallery-preview' => 'shortcode', |
| 333 | 'data-foogallery-value-selector' => 'input:checked', |
| 334 | 'data-foogallery-hidden' => true, |
| 335 | 'data-foogallery-show-when-field' => 'lightbox_button_highlight', |
| 336 | 'data-foogallery-show-when-field-operator' => '===', |
| 337 | 'data-foogallery-show-when-field-value' => 'custom', |
| 338 | ) |
| 339 | ); |
| 340 | |
| 341 | $hide_thumbs_by_default = false; |
| 342 | //only hide the thumbs by default if we are using the Grid PRO template |
| 343 | if ( $template && array_key_exists('slug', $template) && $template['slug'] === 'foogridpro' ) { |
| 344 | $hide_thumbs_by_default = true; |
| 345 | } |
| 346 | |
| 347 | if ( $use_lightbox ) { |
| 348 | $field[] = array( |
| 349 | 'id' => 'lightbox_help_thumbnails', |
| 350 | 'title' => __( 'Thumbnail Strip Settings', 'foogallery' ), |
| 351 | 'desc' => __( 'The below settings will control the thumbnail strip that is shown within the lightbox.', 'foogallery' ), |
| 352 | 'section_id' => $section_id, |
| 353 | 'subsection_id' => 'lightbox-thumbnails', |
| 354 | 'type' => 'help', |
| 355 | 'row_data' => array( |
| 356 | 'data-foogallery-hidden' => true, |
| 357 | 'data-foogallery-show-when-field' => 'lightbox', |
| 358 | 'data-foogallery-show-when-field-operator' => '===', |
| 359 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 360 | ), |
| 361 | ); |
| 362 | } |
| 363 | |
| 364 | $field[] = array( |
| 365 | 'id' => 'lightbox_thumbs', |
| 366 | 'title' => __( 'Thumbnail Strip', 'foogallery' ), |
| 367 | 'desc' => __( 'You can change the position of the thumbnails, or hide them completely.', 'foogallery' ), |
| 368 | 'section_id' => $section_id, |
| 369 | 'subsection_id' => 'lightbox-thumbnails', |
| 370 | 'type' => 'radio', |
| 371 | 'default' => $hide_thumbs_by_default ? 'none' : 'bottom', |
| 372 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_thumbs_choices', array( |
| 373 | 'bottom' => __( 'Bottom', 'foogallery' ), |
| 374 | 'top' => __( 'Top', 'foogallery' ), |
| 375 | 'left' => __( 'Left', 'foogallery' ), |
| 376 | 'right' => __( 'Right', 'foogallery' ), |
| 377 | 'none' => __( 'Hidden', 'foogallery' ), |
| 378 | ) ), |
| 379 | 'row_data' => array( |
| 380 | 'data-foogallery-change-selector' => 'input:radio', |
| 381 | 'data-foogallery-preview' => 'shortcode', |
| 382 | 'data-foogallery-value-selector' => 'input:checked', |
| 383 | 'data-foogallery-hidden' => true, |
| 384 | 'data-foogallery-show-when-field' => 'lightbox', |
| 385 | 'data-foogallery-show-when-field-operator' => '===', |
| 386 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 387 | ) |
| 388 | ); |
| 389 | |
| 390 | $field[] = array( |
| 391 | 'id' => 'lightbox_thumbs_captions', |
| 392 | 'title' => __( 'Thumbnail Strip Captions', 'foogallery' ), |
| 393 | 'desc' => __( 'Whether or not the thumbnail strip should contain captions.', 'foogallery' ), |
| 394 | 'section_id' => $section_id, |
| 395 | 'subsection_id' => 'lightbox-thumbnails', |
| 396 | 'type' => 'radio', |
| 397 | 'default' => 'no', |
| 398 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_thumbs_captions_choices', array( |
| 399 | 'yes' => __( 'Show Captions', 'foogallery' ), |
| 400 | 'no' => __( 'No Captions', 'foogallery' ), |
| 401 | ) ), |
| 402 | 'row_data'=> array( |
| 403 | 'data-foogallery-hidden' => true, |
| 404 | 'data-foogallery-show-when-field' => 'lightbox_thumbs', |
| 405 | 'data-foogallery-show-when-field-operator' => '!==', |
| 406 | 'data-foogallery-show-when-field-value' => 'none', |
| 407 | 'data-foogallery-change-selector' => 'input:radio', |
| 408 | 'data-foogallery-preview' => 'shortcode', |
| 409 | 'data-foogallery-value-selector' => 'input:checked', |
| 410 | ) |
| 411 | ); |
| 412 | |
| 413 | $field[] = array( |
| 414 | 'id' => 'lightbox_thumbs_captions_alignment', |
| 415 | 'title' => __( 'Thumbnail Caption Alignment', 'foogallery' ), |
| 416 | 'section_id' => $section_id, |
| 417 | 'subsection_id' => 'lightbox-thumbnails', |
| 418 | 'type' => 'radio', |
| 419 | 'default' => 'default', |
| 420 | 'choices' => array( |
| 421 | 'default' => __( 'Default', 'foogallery' ), |
| 422 | 'left' => __( 'Left', 'foogallery' ), |
| 423 | 'center' => __( 'Center', 'foogallery' ), |
| 424 | 'right' => __( 'Right', 'foogallery' ), |
| 425 | 'justify' => __( 'Justify', 'foogallery' ), |
| 426 | ), |
| 427 | 'row_data' => array( |
| 428 | 'data-foogallery-change-selector' => 'input:radio', |
| 429 | 'data-foogallery-preview' => 'shortcode', |
| 430 | 'data-foogallery-hidden' => true, |
| 431 | 'data-foogallery-show-when-field' => 'lightbox_thumbs', |
| 432 | 'data-foogallery-show-when-field-operator' => '!==', |
| 433 | 'data-foogallery-show-when-field-value' => 'none', |
| 434 | ) |
| 435 | ); |
| 436 | |
| 437 | $field[] = array( |
| 438 | 'id' => 'lightbox_thumbs_bestfit', |
| 439 | 'title' => __( 'Thumbnails Best Fit', 'foogallery' ), |
| 440 | 'desc' => __( 'Adjust the size of the displayed thumbnails so that they fill the entire space within the strip.', 'foogallery' ), |
| 441 | 'section_id' => $section_id, |
| 442 | 'subsection_id' => 'lightbox-thumbnails', |
| 443 | 'type' => 'radio', |
| 444 | 'default' => '', |
| 445 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_thumbs_bestfit_choices', array( |
| 446 | '' => __( 'Default', 'foogallery' ), |
| 447 | 'yes' => __( 'Best Fit', 'foogallery' ), |
| 448 | ) ), |
| 449 | 'row_data'=> array( |
| 450 | 'data-foogallery-hidden' => true, |
| 451 | 'data-foogallery-show-when-field' => 'lightbox_thumbs', |
| 452 | 'data-foogallery-show-when-field-operator' => '!==', |
| 453 | 'data-foogallery-show-when-field-value' => 'none', |
| 454 | 'data-foogallery-change-selector' => 'input:radio', |
| 455 | 'data-foogallery-preview' => 'shortcode', |
| 456 | 'data-foogallery-value-selector' => 'input:checked', |
| 457 | ) |
| 458 | ); |
| 459 | |
| 460 | $field[] = array( |
| 461 | 'id' => 'lightbox_thumbs_size', |
| 462 | 'title' => __( 'Thumbnail Size', 'foogallery' ), |
| 463 | 'desc' => __( 'Adjust the size of the thumbnail image to display as either small (square) or large (landscape).', 'foogallery' ), |
| 464 | 'section_id' => $section_id, |
| 465 | 'subsection_id' => 'lightbox-thumbnails', |
| 466 | 'type' => 'radio', |
| 467 | 'default' => '', |
| 468 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_thumbs_size_choices', array( |
| 469 | '' => __( 'Normal', 'foogallery' ), |
| 470 | 'small' => __( 'Small (square)', 'foogallery' ), |
| 471 | ) ), |
| 472 | 'row_data'=> array( |
| 473 | 'data-foogallery-hidden' => true, |
| 474 | 'data-foogallery-show-when-field' => 'lightbox_thumbs', |
| 475 | 'data-foogallery-show-when-field-operator' => '!==', |
| 476 | 'data-foogallery-show-when-field-value' => 'none', |
| 477 | 'data-foogallery-change-selector' => 'input:radio', |
| 478 | 'data-foogallery-preview' => 'shortcode', |
| 479 | 'data-foogallery-value-selector' => 'input:checked', |
| 480 | ) |
| 481 | ); |
| 482 | |
| 483 | $field[] = array( |
| 484 | 'id' => 'lightbox_transition', |
| 485 | 'title' => __( 'Transition', 'foogallery' ), |
| 486 | 'desc' => __( 'The transition to apply to the main content area when switching between items.', 'foogallery' ), |
| 487 | 'section_id' => $section_id, |
| 488 | 'subsection_id' => 'lightbox-general', |
| 489 | 'type' => 'radio', |
| 490 | 'default' => 'fade', |
| 491 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_button_highlight_choices', array( |
| 492 | 'fade' => __( 'Fade', 'foogallery' ), |
| 493 | 'horizontal' => __( 'Horizontal', 'foogallery' ), |
| 494 | 'vertical' => __( 'Vertical', 'foogallery' ), |
| 495 | 'none' => __( 'None', 'foogallery' ) |
| 496 | ) ), |
| 497 | 'row_data'=> array( |
| 498 | 'data-foogallery-change-selector' => 'input', |
| 499 | 'data-foogallery-preview' => 'shortcode', |
| 500 | 'data-foogallery-value-selector' => 'input:checked', |
| 501 | 'data-foogallery-hidden' => true, |
| 502 | 'data-foogallery-show-when-field' => 'lightbox', |
| 503 | 'data-foogallery-show-when-field-operator' => '===', |
| 504 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 505 | ) |
| 506 | ); |
| 507 | |
| 508 | $field[] = array( |
| 509 | 'id' => 'lightbox_info_enabled', |
| 510 | 'title' => __( 'Captions Enabled', 'foogallery' ), |
| 511 | 'section_id' => $section_id, |
| 512 | 'subsection_id' => 'lightbox-captions', |
| 513 | 'type' => 'radio', |
| 514 | 'default' => '', |
| 515 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_info_enabled_choices', array( |
| 516 | 'disabled' => __( 'Disabled', 'foogallery' ), |
| 517 | '' => __( 'Enabled', 'foogallery' ), |
| 518 | 'hidden' => __( 'Enabled (but hidden initially)', 'foogallery' ), |
| 519 | ) ), |
| 520 | 'row_data'=> array( |
| 521 | 'data-foogallery-change-selector' => 'input:radio', |
| 522 | 'data-foogallery-preview' => 'shortcode', |
| 523 | 'data-foogallery-value-selector' => 'input:checked', |
| 524 | 'data-foogallery-hidden' => true, |
| 525 | 'data-foogallery-show-when-field' => 'lightbox', |
| 526 | 'data-foogallery-show-when-field-operator' => '===', |
| 527 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 528 | ) |
| 529 | ); |
| 530 | |
| 531 | $field[] = array( |
| 532 | 'id' => 'lightbox_info_position', |
| 533 | 'title' => __( 'Caption Position', 'foogallery' ), |
| 534 | 'desc' => __( 'The position of the captions within the lightbox.', 'foogallery' ), |
| 535 | 'section_id' => $section_id, |
| 536 | 'subsection_id' => 'lightbox-captions', |
| 537 | 'type' => 'radio', |
| 538 | 'default' => 'bottom', |
| 539 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_info_position_choices', array( |
| 540 | 'bottom' => __( 'Bottom', 'foogallery' ), |
| 541 | 'top' => __( 'Top', 'foogallery' ), |
| 542 | 'left' => __( 'Left', 'foogallery' ), |
| 543 | 'right' => __( 'Right', 'foogallery' ), |
| 544 | //'none' => __( 'Hidden', 'foogallery' ), |
| 545 | ) ), |
| 546 | 'row_data'=> array( |
| 547 | 'data-foogallery-change-selector' => 'input:radio', |
| 548 | 'data-foogallery-preview' => 'shortcode', |
| 549 | 'data-foogallery-value-selector' => 'input:checked', |
| 550 | 'data-foogallery-hidden' => true, |
| 551 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 552 | 'data-foogallery-show-when-field-operator' => '!==', |
| 553 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 554 | ) |
| 555 | ); |
| 556 | |
| 557 | $field[] = array( |
| 558 | 'id' => 'lightbox_info_alignment', |
| 559 | 'title' => __( 'Caption Text Alignment', 'foogallery' ), |
| 560 | 'desc' => __( 'Change the horizontal text alignment of the captions', 'foogallery' ), |
| 561 | 'section_id' => $section_id, |
| 562 | 'subsection_id' => 'lightbox-captions', |
| 563 | 'type' => 'radio', |
| 564 | 'default' => 'default', |
| 565 | 'choices' => array( |
| 566 | 'default' => __( 'Default', 'foogallery' ), |
| 567 | 'left' => __( 'Left', 'foogallery' ), |
| 568 | 'center' => __( 'Center', 'foogallery' ), |
| 569 | 'right' => __( 'Right', 'foogallery' ), |
| 570 | 'justify' => __( 'Justify', 'foogallery' ), |
| 571 | ), |
| 572 | 'row_data' => array( |
| 573 | 'data-foogallery-change-selector' => 'input:radio', |
| 574 | 'data-foogallery-preview' => 'shortcode', |
| 575 | 'data-foogallery-hidden' => true, |
| 576 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 577 | 'data-foogallery-show-when-field-operator' => '!==', |
| 578 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 579 | ) |
| 580 | ); |
| 581 | |
| 582 | $field[] = array( |
| 583 | 'id' => 'lightbox_info_overlay', |
| 584 | 'title' => __( 'Caption Display', 'foogallery' ), |
| 585 | 'desc' => __( 'Whether or not the caption is overlaid on top of the content, or is inline (outside of the content).', 'foogallery' ), |
| 586 | 'section_id' => $section_id, |
| 587 | 'subsection_id' => 'lightbox-captions', |
| 588 | 'type' => 'radio', |
| 589 | 'default' => 'yes', |
| 590 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_info_choices', array( |
| 591 | 'yes' => __( 'Overlay', 'foogallery' ), |
| 592 | 'no' => __( 'Inline', 'foogallery' ), |
| 593 | ) ), |
| 594 | 'row_data'=> array( |
| 595 | 'data-foogallery-change-selector' => 'input:radio', |
| 596 | 'data-foogallery-preview' => 'shortcode', |
| 597 | 'data-foogallery-value-selector' => 'input:checked', |
| 598 | 'data-foogallery-hidden' => true, |
| 599 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 600 | 'data-foogallery-show-when-field-operator' => '!==', |
| 601 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 602 | ) |
| 603 | ); |
| 604 | |
| 605 | $field[] = array( |
| 606 | 'id' => 'lightbox_info_autohide_mobile', |
| 607 | 'title' => __( 'Auto-hide on Mobile', 'foogallery' ), |
| 608 | 'desc' => __( 'Whether captions should automatically hide on mobile devices. When disabled, captions will remain visible on mobile.', 'foogallery' ), |
| 609 | 'section_id' => $section_id, |
| 610 | 'subsection_id' => 'lightbox-captions', |
| 611 | 'type' => 'radio', |
| 612 | 'default' => 'yes', |
| 613 | 'choices' => array( |
| 614 | 'yes' => __( 'Auto-hide (default)', 'foogallery' ), |
| 615 | 'no' => __( 'Always visible', 'foogallery' ), |
| 616 | ), |
| 617 | 'row_data'=> array( |
| 618 | 'data-foogallery-change-selector' => 'input:radio', |
| 619 | 'data-foogallery-preview' => 'shortcode', |
| 620 | 'data-foogallery-value-selector' => 'input:checked', |
| 621 | 'data-foogallery-hidden' => true, |
| 622 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 623 | 'data-foogallery-show-when-field-operator' => '!==', |
| 624 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 625 | ) |
| 626 | ); |
| 627 | |
| 628 | $field[] = array( |
| 629 | 'id' => 'lightbox_caption_override', |
| 630 | 'title' => __( 'Caption Source', 'foogallery' ), |
| 631 | 'desc' => __( 'The captions can be different to the thumbnail captions.', 'foogallery' ), |
| 632 | 'section_id' => $section_id, |
| 633 | 'subsection_id' => 'lightbox-captions', |
| 634 | 'type' => 'radio', |
| 635 | 'default' => '', |
| 636 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_caption_override_choices', array( |
| 637 | '' => __( 'Same As Thumbnail', 'foogallery' ), |
| 638 | 'override' => __( 'Override', 'foogallery' ), |
| 639 | 'custom' => __( 'Custom', 'foogallery' ), |
| 640 | ) ), |
| 641 | 'row_data'=> array( |
| 642 | 'data-foogallery-change-selector' => 'input:radio', |
| 643 | 'data-foogallery-preview' => 'shortcode', |
| 644 | 'data-foogallery-value-selector' => 'input:checked', |
| 645 | 'data-foogallery-hidden' => true, |
| 646 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 647 | 'data-foogallery-show-when-field-operator' => '!==', |
| 648 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 649 | ) |
| 650 | ); |
| 651 | |
| 652 | $field[] = array( |
| 653 | 'id' => 'lightbox_caption_override_title', |
| 654 | 'title' => __( 'Override Caption Title', 'foogallery' ), |
| 655 | 'desc' => __( 'You can override the caption title to be different from the thumbnail caption title.', 'foogallery' ), |
| 656 | 'section_id' => $section_id, |
| 657 | 'subsection_id' => 'lightbox-captions', |
| 658 | 'type' => 'radio', |
| 659 | 'default' => '', |
| 660 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_caption_title_choices', array( |
| 661 | '' => __( 'Same As Thumbnail', 'foogallery' ), |
| 662 | 'title' => __( 'Attachment Title', 'foogallery' ), |
| 663 | 'caption' => __( 'Attachment Caption', 'foogallery' ), |
| 664 | 'alt' => __( 'Attachment Alt', 'foogallery' ), |
| 665 | 'desc' => __( 'Attachment Description', 'foogallery' ), |
| 666 | 'none' => __( 'None', 'foogallery' ), |
| 667 | ) ), |
| 668 | 'row_data'=> array( |
| 669 | 'data-foogallery-hidden' => true, |
| 670 | 'data-foogallery-show-when-field' => 'lightbox_caption_override', |
| 671 | 'data-foogallery-show-when-field-operator' => '===', |
| 672 | 'data-foogallery-show-when-field-value' => 'override', |
| 673 | 'data-foogallery-change-selector' => 'input:radio', |
| 674 | 'data-foogallery-preview' => 'shortcode', |
| 675 | 'data-foogallery-value-selector' => 'input:checked', |
| 676 | ) |
| 677 | ); |
| 678 | |
| 679 | $field[] = array( |
| 680 | 'id' => 'lightbox_caption_override_desc', |
| 681 | 'title' => __( 'Override Caption Desc.', 'foogallery' ), |
| 682 | 'desc' => __( 'You can override the caption description to be different from the thumbnail caption description.', 'foogallery' ), |
| 683 | 'section_id' => $section_id, |
| 684 | 'subsection_id' => 'lightbox-captions', |
| 685 | 'type' => 'radio', |
| 686 | 'default' => '', |
| 687 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_caption_title_choices', array( |
| 688 | '' => __( 'Same As Thumbnail', 'foogallery' ), |
| 689 | 'title' => __( 'Attachment Title', 'foogallery' ), |
| 690 | 'caption' => __( 'Attachment Caption', 'foogallery' ), |
| 691 | 'alt' => __( 'Attachment Alt', 'foogallery' ), |
| 692 | 'desc' => __( 'Attachment Description', 'foogallery' ), |
| 693 | 'none' => __( 'None', 'foogallery' ), |
| 694 | ) ), |
| 695 | 'row_data'=> array( |
| 696 | 'data-foogallery-hidden' => true, |
| 697 | 'data-foogallery-show-when-field' => 'lightbox_caption_override', |
| 698 | 'data-foogallery-show-when-field-operator' => '===', |
| 699 | 'data-foogallery-show-when-field-value' => 'override', |
| 700 | 'data-foogallery-change-selector' => 'input:radio', |
| 701 | 'data-foogallery-preview' => 'shortcode', |
| 702 | 'data-foogallery-value-selector' => 'input:checked', |
| 703 | ) |
| 704 | ); |
| 705 | |
| 706 | $field[] = array( |
| 707 | 'id' => 'lightbox_auto_progress', |
| 708 | 'title' => __( 'Auto Progress', 'foogallery' ), |
| 709 | 'desc' => __( 'Auto progress to the next item after a specified time.', 'foogallery' ), |
| 710 | 'section_id' => $section_id, |
| 711 | 'subsection_id' => 'lightbox-general', |
| 712 | 'type' => 'radio', |
| 713 | 'default' => 'no', |
| 714 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_auto_progress_choices', array( |
| 715 | 'yes' => __( 'Yes', 'foogallery' ), |
| 716 | 'no' => __( 'No', 'foogallery' ), |
| 717 | ) ), |
| 718 | 'row_data'=> array( |
| 719 | 'data-foogallery-change-selector' => 'input:radio', |
| 720 | 'data-foogallery-preview' => 'shortcode', |
| 721 | 'data-foogallery-value-selector' => 'input:checked', |
| 722 | 'data-foogallery-hidden' => true, |
| 723 | 'data-foogallery-show-when-field' => 'lightbox', |
| 724 | 'data-foogallery-show-when-field-operator' => '===', |
| 725 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 726 | ) |
| 727 | ); |
| 728 | |
| 729 | $field[] = array( |
| 730 | 'id' => 'lightbox_auto_progress_seconds', |
| 731 | 'title' => __( 'Auto Progress Seconds', 'foogallery' ), |
| 732 | 'desc' => __( 'The time in seconds to display content before auto progressing to the next item.', 'foogallery' ), |
| 733 | 'section_id' => $section_id, |
| 734 | 'subsection_id' => 'lightbox-general', |
| 735 | 'type' => 'number', |
| 736 | 'default' => '10', |
| 737 | 'row_data'=> array( |
| 738 | 'data-foogallery-hidden' => true, |
| 739 | 'data-foogallery-show-when-field' => 'lightbox_auto_progress', |
| 740 | 'data-foogallery-show-when-field-operator' => '===', |
| 741 | 'data-foogallery-show-when-field-value' => 'yes', |
| 742 | 'data-foogallery-change-selector' => 'input:radio', |
| 743 | 'data-foogallery-preview' => 'shortcode', |
| 744 | 'data-foogallery-value-selector' => 'input:checked', |
| 745 | ) |
| 746 | ); |
| 747 | |
| 748 | $field[] = array( |
| 749 | 'id' => 'lightbox_auto_progress_start', |
| 750 | 'title' => __( 'Auto Progress Start', 'foogallery' ), |
| 751 | 'desc' => __( 'If the auto-progress will automatically start or not.', 'foogallery' ), |
| 752 | 'section_id' => $section_id, |
| 753 | 'subsection_id' => 'lightbox-general', |
| 754 | 'type' => 'radio', |
| 755 | 'choices' => array( |
| 756 | 'yes' => __( 'Yes', 'foogallery' ), |
| 757 | 'no' => __( 'No', 'foogallery' ), |
| 758 | ), |
| 759 | 'default' => 'yes', |
| 760 | 'row_data'=> array( |
| 761 | 'data-foogallery-hidden' => true, |
| 762 | 'data-foogallery-show-when-field' => 'lightbox_auto_progress', |
| 763 | 'data-foogallery-show-when-field-operator' => '===', |
| 764 | 'data-foogallery-show-when-field-value' => 'yes', |
| 765 | 'data-foogallery-change-selector' => 'input:radio', |
| 766 | 'data-foogallery-preview' => 'shortcode', |
| 767 | 'data-foogallery-value-selector' => 'input:checked', |
| 768 | ) |
| 769 | ); |
| 770 | |
| 771 | $field[] = array( |
| 772 | 'id' => 'lightbox_auto_progress_button', |
| 773 | 'title' => __( 'Auto Progress Button', 'foogallery' ), |
| 774 | 'desc' => __( 'Show or hide the auto progress control button. Hiding the button does not stop auto progress.', 'foogallery' ), |
| 775 | 'section_id' => $section_id, |
| 776 | 'subsection_id' => 'lightbox-general', |
| 777 | 'type' => 'radio', |
| 778 | 'choices' => array( |
| 779 | 'yes' => __( 'Shown', 'foogallery' ), |
| 780 | 'no' => __( 'Hidden', 'foogallery' ), |
| 781 | ), |
| 782 | 'default' => 'yes', |
| 783 | 'row_data'=> array( |
| 784 | 'data-foogallery-hidden' => true, |
| 785 | 'data-foogallery-show-when-field' => 'lightbox_auto_progress', |
| 786 | 'data-foogallery-show-when-field-operator' => '===', |
| 787 | 'data-foogallery-show-when-field-value' => 'yes', |
| 788 | 'data-foogallery-change-selector' => 'input:radio', |
| 789 | 'data-foogallery-preview' => 'shortcode', |
| 790 | 'data-foogallery-value-selector' => 'input:checked', |
| 791 | ) |
| 792 | ); |
| 793 | |
| 794 | $field[] = array( |
| 795 | 'id' => 'lightbox_fit_media', |
| 796 | 'title' => __( 'Fit Media', 'foogallery' ), |
| 797 | 'desc' => __( 'Whether or not to force images to fill the content area. Aspect ratios are maintained, the image is simply scaled so it covers the entire available area.', 'foogallery' ), |
| 798 | 'section_id' => $section_id, |
| 799 | 'subsection_id' => 'lightbox-general', |
| 800 | 'type' => 'radio', |
| 801 | 'default' => 'no', |
| 802 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_fit_media_choices', array( |
| 803 | 'yes' => __( 'Yes', 'foogallery' ), |
| 804 | 'no' => __( 'No', 'foogallery' ), |
| 805 | ) ), |
| 806 | 'row_data'=> array( |
| 807 | 'data-foogallery-change-selector' => 'input:radio', |
| 808 | 'data-foogallery-preview' => 'shortcode', |
| 809 | 'data-foogallery-value-selector' => 'input:checked', |
| 810 | 'data-foogallery-hidden' => true, |
| 811 | 'data-foogallery-show-when-field' => 'lightbox', |
| 812 | 'data-foogallery-show-when-field-operator' => '===', |
| 813 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 814 | ) |
| 815 | ); |
| 816 | |
| 817 | $field[] = array( |
| 818 | 'id' => 'lightbox_no_scrollbars', |
| 819 | 'title' => __( 'Scroll Bars', 'foogallery' ), |
| 820 | 'desc' => __( 'Whether or not to hide the page scrollbars when maximizing.', 'foogallery' ), |
| 821 | 'section_id' => $section_id, |
| 822 | 'subsection_id' => 'lightbox-general', |
| 823 | 'type' => 'radio', |
| 824 | 'default' => 'no', |
| 825 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_no_scrollbars_choices', array( |
| 826 | 'yes' => __( 'Default', 'foogallery' ), |
| 827 | 'no' => __( 'Hidden', 'foogallery' ), |
| 828 | ) ), |
| 829 | 'row_data'=> array( |
| 830 | 'data-foogallery-change-selector' => 'input:radio', |
| 831 | 'data-foogallery-preview' => 'shortcode', |
| 832 | 'data-foogallery-value-selector' => 'input:checked', |
| 833 | 'data-foogallery-hidden' => true, |
| 834 | 'data-foogallery-show-when-field' => 'lightbox', |
| 835 | 'data-foogallery-show-when-field-operator' => '===', |
| 836 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 837 | ) |
| 838 | ); |
| 839 | |
| 840 | $field[] = array( |
| 841 | 'id' => 'lightbox_mobile_layout', |
| 842 | 'title' => __( 'Mobile Layout', 'foogallery' ), |
| 843 | 'desc' => __( 'Which layout to use for the lightbox when on mobile.', 'foogallery' ), |
| 844 | 'section_id' => $section_id, |
| 845 | 'subsection_id' => 'lightbox-general', |
| 846 | 'type' => 'radio', |
| 847 | 'class' => 'foogallery-radios-stacked', |
| 848 | 'default' => '', |
| 849 | 'choices' => array( |
| 850 | '' => __( 'Mobile Optimized Layout', 'foogallery' ), |
| 851 | 'no' => __( 'Same As Desktop', 'foogallery' ), |
| 852 | ), |
| 853 | 'row_data'=> array( |
| 854 | 'data-foogallery-change-selector' => 'input:radio', |
| 855 | 'data-foogallery-preview' => 'shortcode', |
| 856 | 'data-foogallery-value-selector' => 'input:checked', |
| 857 | 'data-foogallery-hidden' => true, |
| 858 | 'data-foogallery-show-when-field' => 'lightbox', |
| 859 | 'data-foogallery-show-when-field-operator' => '===', |
| 860 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 861 | ) |
| 862 | ); |
| 863 | |
| 864 | $field[] = array( |
| 865 | 'id' => 'lightbox_buttons_display', |
| 866 | 'title' => __( 'Controls Display', 'foogallery' ), |
| 867 | 'desc' => __( 'Whether or not the control buttons are overlaid on top of the content, or are inline (outside of the content).', 'foogallery' ), |
| 868 | 'section_id' => $section_id, |
| 869 | 'subsection_id' => 'lightbox-controls', |
| 870 | 'type' => 'radio', |
| 871 | 'default' => 'no', |
| 872 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_buttons_display', array( |
| 873 | 'yes' => __( 'Overlay', 'foogallery' ), |
| 874 | 'no' => __( 'Inline', 'foogallery' ), |
| 875 | ) ), |
| 876 | 'row_data'=> array( |
| 877 | 'data-foogallery-change-selector' => 'input:radio', |
| 878 | 'data-foogallery-preview' => 'shortcode', |
| 879 | 'data-foogallery-value-selector' => 'input:checked', |
| 880 | 'data-foogallery-hidden' => true, |
| 881 | 'data-foogallery-show-when-field' => 'lightbox', |
| 882 | 'data-foogallery-show-when-field-operator' => '===', |
| 883 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 884 | ) |
| 885 | ); |
| 886 | |
| 887 | $field[] = array( |
| 888 | 'id' => 'lightbox_hover_buttons', |
| 889 | 'title' => __( 'Show Controls On Hover', 'foogallery' ), |
| 890 | 'desc' => __( 'Only show the control buttons when you hover the mouse over.', 'foogallery' ), |
| 891 | 'section_id' => $section_id, |
| 892 | 'subsection_id' => 'lightbox-controls', |
| 893 | 'type' => 'radio', |
| 894 | 'default' => 'no', |
| 895 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_hover_buttons_choices', array( |
| 896 | 'yes' => __( 'Yes', 'foogallery' ), |
| 897 | 'no' => __( 'No', 'foogallery' ), |
| 898 | ) ), |
| 899 | 'row_data'=> array( |
| 900 | 'data-foogallery-change-selector' => 'input:radio', |
| 901 | 'data-foogallery-preview' => 'shortcode', |
| 902 | 'data-foogallery-value-selector' => 'input:checked', |
| 903 | 'data-foogallery-hidden' => true, |
| 904 | 'data-foogallery-show-when-field' => 'lightbox', |
| 905 | 'data-foogallery-show-when-field-operator' => '===', |
| 906 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 907 | ) |
| 908 | ); |
| 909 | |
| 910 | //Only show this setting for gallery templates that use the lightbox |
| 911 | $field[] = array( |
| 912 | 'id' => 'lightbox_show_fullscreen_button', |
| 913 | 'title' => __( 'Fullscreen Button', 'foogallery' ), |
| 914 | 'desc' => __( 'Whether of not to show the Fullscreen button', 'foogallery' ), |
| 915 | 'section_id' => $section_id, |
| 916 | 'subsection_id' => 'lightbox-controls', |
| 917 | 'type' => 'radio', |
| 918 | 'default' => $use_lightbox ? 'yes' : 'no', |
| 919 | 'choices' => array( |
| 920 | 'yes' => __( 'Shown', 'foogallery' ), |
| 921 | 'no' => __( 'Hidden', 'foogallery' ), |
| 922 | ), |
| 923 | 'row_data' => array( |
| 924 | 'data-foogallery-change-selector' => 'input:radio', |
| 925 | 'data-foogallery-preview' => 'shortcode', |
| 926 | 'data-foogallery-value-selector' => 'input:checked', |
| 927 | 'data-foogallery-hidden' => true, |
| 928 | 'data-foogallery-show-when-field' => 'lightbox', |
| 929 | 'data-foogallery-show-when-field-operator' => '===', |
| 930 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 931 | ) |
| 932 | ); |
| 933 | |
| 934 | //add this setting for gallery templates that use the panel, not lightbox |
| 935 | if ( !$use_lightbox ) { |
| 936 | $field[] = array( |
| 937 | 'id' => 'lightbox_show_maximize_button', |
| 938 | 'title' => __( 'Maximise Button', 'foogallery' ), |
| 939 | 'desc' => __( 'Whether of not to show the Maximise button', 'foogallery' ), |
| 940 | 'section_id' => $section_id, |
| 941 | 'subsection_id' => 'lightbox-controls', |
| 942 | 'type' => 'radio', |
| 943 | 'default' => 'yes', |
| 944 | 'choices' => array( |
| 945 | 'yes' => __( 'Shown', 'foogallery' ), |
| 946 | 'no' => __( 'Hidden', 'foogallery' ), |
| 947 | ), |
| 948 | 'row_data' => array( |
| 949 | 'data-foogallery-change-selector' => 'input:radio', |
| 950 | 'data-foogallery-preview' => 'shortcode', |
| 951 | 'data-foogallery-value-selector' => 'input:checked', |
| 952 | 'data-foogallery-hidden' => true, |
| 953 | 'data-foogallery-show-when-field' => 'lightbox', |
| 954 | 'data-foogallery-show-when-field-operator' => '===', |
| 955 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 956 | ) |
| 957 | ); |
| 958 | } |
| 959 | |
| 960 | $field[] = array( |
| 961 | 'id' => 'lightbox_show_caption_button', |
| 962 | 'title' => __( 'Caption Button', 'foogallery' ), |
| 963 | 'desc' => __( 'Whether of not to show the Caption button', 'foogallery' ), |
| 964 | 'section_id' => $section_id, |
| 965 | 'subsection_id' => 'lightbox-controls', |
| 966 | 'type' => 'radio', |
| 967 | 'default' => 'yes', |
| 968 | 'choices' => array( |
| 969 | 'yes' => __( 'Shown', 'foogallery' ), |
| 970 | 'no' => __( 'Hidden', 'foogallery' ), |
| 971 | ), |
| 972 | 'row_data' => array( |
| 973 | 'data-foogallery-change-selector' => 'input:radio', |
| 974 | 'data-foogallery-preview' => 'shortcode', |
| 975 | 'data-foogallery-value-selector' => 'input:checked', |
| 976 | 'data-foogallery-hidden' => true, |
| 977 | 'data-foogallery-show-when-field' => 'lightbox', |
| 978 | 'data-foogallery-show-when-field-operator' => '===', |
| 979 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 980 | ) |
| 981 | ); |
| 982 | |
| 983 | $field[] = array( |
| 984 | 'id' => 'lightbox_show_thumbstrip_button', |
| 985 | 'title' => __( 'Thumbnail Strip Button', 'foogallery' ), |
| 986 | 'desc' => __( 'Whether of not to show the thumbnail strip control button', 'foogallery' ), |
| 987 | 'section_id' => $section_id, |
| 988 | 'subsection_id' => 'lightbox-controls', |
| 989 | 'type' => 'radio', |
| 990 | 'default' => 'no', |
| 991 | 'choices' => array( |
| 992 | 'yes' => __( 'Shown', 'foogallery' ), |
| 993 | 'no' => __( 'Hidden', 'foogallery' ), |
| 994 | ), |
| 995 | 'row_data' => array( |
| 996 | 'data-foogallery-change-selector' => 'input:radio', |
| 997 | 'data-foogallery-preview' => 'shortcode', |
| 998 | 'data-foogallery-value-selector' => 'input:checked', |
| 999 | 'data-foogallery-hidden' => true, |
| 1000 | 'data-foogallery-show-when-field' => 'lightbox', |
| 1001 | 'data-foogallery-show-when-field-operator' => '===', |
| 1002 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 1003 | ) |
| 1004 | ); |
| 1005 | |
| 1006 | $field[] = array( |
| 1007 | 'id' => 'lightbox_show_download_button', |
| 1008 | 'title' => __( 'Download Button', 'foogallery' ), |
| 1009 | 'desc' => __( 'Whether of not to show the download button', 'foogallery' ), |
| 1010 | 'section_id' => $section_id, |
| 1011 | 'subsection_id' => 'lightbox-controls', |
| 1012 | 'type' => 'radio', |
| 1013 | 'default' => 'no', |
| 1014 | 'choices' => array( |
| 1015 | 'yes' => __( 'Shown', 'foogallery' ), |
| 1016 | 'no' => __( 'Hidden', 'foogallery' ), |
| 1017 | ), |
| 1018 | 'row_data' => array( |
| 1019 | 'data-foogallery-change-selector' => 'input:radio', |
| 1020 | 'data-foogallery-preview' => 'shortcode', |
| 1021 | 'data-foogallery-value-selector' => 'input:checked', |
| 1022 | 'data-foogallery-hidden' => true, |
| 1023 | 'data-foogallery-show-when-field' => 'lightbox', |
| 1024 | 'data-foogallery-show-when-field-operator' => '===', |
| 1025 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 1026 | ) |
| 1027 | ); |
| 1028 | |
| 1029 | $field[] = array( |
| 1030 | 'id' => 'lightbox_show_nav_buttons', |
| 1031 | 'title' => __( 'Prev/Next Buttons', 'foogallery' ), |
| 1032 | 'desc' => __( 'Whether of not to show the navigation (prev/next) buttons', 'foogallery' ), |
| 1033 | 'section_id' => $section_id, |
| 1034 | 'subsection_id' => 'lightbox-controls', |
| 1035 | 'type' => 'radio', |
| 1036 | 'default' => 'yes', |
| 1037 | 'choices' => array( |
| 1038 | 'yes' => __( 'Shown', 'foogallery' ), |
| 1039 | 'no' => __( 'Hidden', 'foogallery' ), |
| 1040 | ), |
| 1041 | 'row_data' => array( |
| 1042 | 'data-foogallery-change-selector' => 'input:radio', |
| 1043 | 'data-foogallery-preview' => 'shortcode', |
| 1044 | 'data-foogallery-value-selector' => 'input:checked', |
| 1045 | 'data-foogallery-hidden' => true, |
| 1046 | 'data-foogallery-show-when-field' => 'lightbox', |
| 1047 | 'data-foogallery-show-when-field-operator' => '===', |
| 1048 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 1049 | ) |
| 1050 | ); |
| 1051 | |
| 1052 | //find the index of the first Hover Effect field |
| 1053 | $index = foogallery_admin_fields_find_index_of_section( $fields, 'hover-effects' ); |
| 1054 | |
| 1055 | array_splice( $fields, $index, 0, $field ); |
| 1056 | |
| 1057 | return $fields; |
| 1058 | } |
| 1059 | |
| 1060 | /** |
| 1061 | * Add the required data options if needed |
| 1062 | * |
| 1063 | * @param $options |
| 1064 | * @param $gallery FooGallery |
| 1065 | * |
| 1066 | * @param $attributes array |
| 1067 | * |
| 1068 | * @return array |
| 1069 | */ |
| 1070 | function add_data_options($options, $gallery, $attributes) { |
| 1071 | $template = foogallery_get_gallery_template( $gallery->gallery_template ); |
| 1072 | if ( $template && array_key_exists( 'panel_support', $template ) && true === $template['panel_support'] ) { |
| 1073 | |
| 1074 | $options['template'] = $this->get_options_from_settings(); |
| 1075 | |
| 1076 | } |
| 1077 | |
| 1078 | $show_download_button = foogallery_gallery_template_setting( 'lightbox_show_download_button', false ); |
| 1079 | if ( false !== $show_download_button ) { |
| 1080 | $options['panel']['buttons']['download'] = ( 'yes' === $show_download_button ); |
| 1081 | } |
| 1082 | |
| 1083 | return $options; |
| 1084 | } |
| 1085 | |
| 1086 | /** |
| 1087 | * Returns the Dashicon that can be used in the settings tabs |
| 1088 | * |
| 1089 | * @param $section_slug |
| 1090 | * |
| 1091 | * @return string |
| 1092 | */ |
| 1093 | function add_section_icons( $section_slug ) { |
| 1094 | if ( 'lightbox' === $section_slug || 'panel' === $section_slug ) { |
| 1095 | return 'dashicons-grid-view'; |
| 1096 | } |
| 1097 | |
| 1098 | return $section_slug; |
| 1099 | } |
| 1100 | |
| 1101 | /** |
| 1102 | * Add the FooGallery Lightbox |
| 1103 | * @param $lightboxes |
| 1104 | * |
| 1105 | * @return mixed |
| 1106 | */ |
| 1107 | function add_lightbox($lightboxes) { |
| 1108 | $lightboxes['foogallery'] = foogallery_lightbox_name(); |
| 1109 | return $lightboxes; |
| 1110 | } |
| 1111 | |
| 1112 | /** |
| 1113 | * Change the default for lightbox |
| 1114 | * |
| 1115 | * @param $field |
| 1116 | * @param $gallery_template |
| 1117 | * @return mixed |
| 1118 | */ |
| 1119 | function make_foogallery_default_lightbox( $field, $gallery_template ) { |
| 1120 | if (isset($field['lightbox']) && true === $field['lightbox']) { |
| 1121 | $field['default'] = 'foogallery'; |
| 1122 | } |
| 1123 | |
| 1124 | return $field; |
| 1125 | } |
| 1126 | |
| 1127 | /** |
| 1128 | * Append the needed data attributes to the container div for the lightbox settings |
| 1129 | * |
| 1130 | * @param $attributes |
| 1131 | * @param $gallery |
| 1132 | * |
| 1133 | * @return array |
| 1134 | */ |
| 1135 | function add_lightbox_data_attributes( $attributes, $gallery ) { |
| 1136 | $template = foogallery_get_gallery_template( $gallery->gallery_template ); |
| 1137 | |
| 1138 | //only add the lightbox data attribute for the templates where a panel is used and not a lightbox |
| 1139 | if ( $template && !array_key_exists( 'panel_support', $template ) ) { |
| 1140 | |
| 1141 | $thumbnail_link = foogallery_gallery_template_setting( 'thumbnail_link', '' ); |
| 1142 | |
| 1143 | //check if lightbox set to foogallery |
| 1144 | if ( 'foogallery' === foogallery_gallery_template_setting_lightbox() && 'none' !== $thumbnail_link ) { |
| 1145 | |
| 1146 | $encoded_options = foogallery_json_encode( $this->get_options_from_settings() ); |
| 1147 | |
| 1148 | $attributes['data-foogallery-lightbox'] = $encoded_options; |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | return $attributes; |
| 1153 | } |
| 1154 | |
| 1155 | /** |
| 1156 | * return the options for the lightbox/panel |
| 1157 | * |
| 1158 | * @return array |
| 1159 | */ |
| 1160 | private function get_options_from_settings() { |
| 1161 | global $current_foogallery_template; |
| 1162 | $options = array(); |
| 1163 | |
| 1164 | $hide_thumbs_by_default = false; |
| 1165 | //only hide the thumbs by default if we are using the Grid PRO template |
| 1166 | if ( $current_foogallery_template && 'foogridpro' === $current_foogallery_template ) { |
| 1167 | $hide_thumbs_by_default = true; |
| 1168 | } |
| 1169 | |
| 1170 | $theme = foogallery_gallery_template_setting( 'lightbox_theme', '' ); |
| 1171 | if ( !empty( $theme ) ) { |
| 1172 | $options['theme'] = $theme; |
| 1173 | } |
| 1174 | |
| 1175 | $button_theme = foogallery_gallery_template_setting( 'lightbox_button_theme', '' ); |
| 1176 | if ( !empty( $button_theme ) && 'custom' === $button_theme ) { |
| 1177 | $button_theme = foogallery_gallery_template_setting( 'lightbox_custom_button_theme', 'fg-button-light' ); |
| 1178 | $options['button'] = $button_theme; |
| 1179 | } |
| 1180 | |
| 1181 | $button_highlight = foogallery_gallery_template_setting( 'lightbox_button_highlight', '' ); |
| 1182 | if ( !empty( $button_highlight ) && 'custom' === $button_highlight ) { |
| 1183 | $button_highlight = foogallery_gallery_template_setting( 'lightbox_custom_button_highlight', 'fg-highlight-light' ); |
| 1184 | $options['highlight'] = $button_highlight; |
| 1185 | } |
| 1186 | |
| 1187 | $thumbs = foogallery_gallery_template_setting( 'lightbox_thumbs', $hide_thumbs_by_default ? 'none' : 'bottom' ); |
| 1188 | $options['thumbs'] = $thumbs; |
| 1189 | if ( 'none' !== $thumbs ) { |
| 1190 | $options['thumbsCaptions'] = foogallery_gallery_template_setting( 'lightbox_thumbs_captions', 'no' ) === 'yes'; |
| 1191 | $options['thumbsBestFit'] = foogallery_gallery_template_setting( 'lightbox_thumbs_bestfit', '' ) === 'yes'; |
| 1192 | $options['thumbsSmall'] = foogallery_gallery_template_setting( 'lightbox_thumbs_size', '' ) === 'small'; |
| 1193 | $options['thumbsCaptionsAlign'] = foogallery_gallery_template_setting( 'lightbox_thumbs_captions_alignment', 'default' ); |
| 1194 | } |
| 1195 | |
| 1196 | $info_enabled = foogallery_gallery_template_setting( 'lightbox_info_enabled', '' ); |
| 1197 | $info_position = foogallery_gallery_template_setting( 'lightbox_info_position', 'bottom' ); |
| 1198 | |
| 1199 | //check for legacy lightbox_info_position of 'none' or new lightbox_info_enabled setting |
| 1200 | if ( 'none' === $info_position || 'disabled' === $info_enabled ) { |
| 1201 | $options['info'] = false; |
| 1202 | } else { |
| 1203 | $options['info'] = $info_position; |
| 1204 | $options['infoVisible'] = 'hidden' !== $info_enabled; |
| 1205 | $options['infoOverlay'] = foogallery_gallery_template_setting( 'lightbox_info_overlay', 'yes' ) === 'yes'; |
| 1206 | } |
| 1207 | |
| 1208 | $options['infoAlign'] = foogallery_gallery_template_setting( 'lightbox_info_alignment', 'default' ); |
| 1209 | |
| 1210 | // Handle mobile caption auto-hide setting |
| 1211 | $mobile_autohide = foogallery_gallery_template_setting( 'lightbox_info_autohide_mobile', 'yes' ); |
| 1212 | if ( 'no' === $mobile_autohide ) { |
| 1213 | $options['infoAutoHide'] = false; |
| 1214 | } |
| 1215 | |
| 1216 | $options['transition'] = foogallery_gallery_template_setting( 'lightbox_transition', 'fade' ); |
| 1217 | |
| 1218 | $auto_progress = foogallery_gallery_template_setting( 'lightbox_auto_progress', 'no' ) === 'yes'; |
| 1219 | if ( $auto_progress ) { |
| 1220 | $options['autoProgress'] = intval( foogallery_gallery_template_setting( 'lightbox_auto_progress_seconds', '10' ) ); |
| 1221 | $options['autoProgressStart'] = foogallery_gallery_template_setting( 'lightbox_auto_progress_start', 'yes' ) === 'yes'; |
| 1222 | $options['autoProgressVisible'] = foogallery_gallery_template_setting( 'lightbox_auto_progress_button', 'yes' ) === 'yes'; |
| 1223 | } |
| 1224 | |
| 1225 | $options['hoverButtons'] = foogallery_gallery_template_setting( 'lightbox_hover_buttons', 'no' ) === 'yes'; |
| 1226 | $options['fitMedia'] = foogallery_gallery_template_setting( 'lightbox_fit_media', 'no' ) === 'yes'; |
| 1227 | $options['noScrollbars'] = foogallery_gallery_template_setting( 'lightbox_no_scrollbars', 'no' ) !== 'yes'; |
| 1228 | $options['preserveButtonSpace'] = foogallery_gallery_template_setting( 'lightbox_buttons_display', 'no' ) === 'no'; |
| 1229 | |
| 1230 | $no_mobile = foogallery_gallery_template_setting( 'lightbox_mobile_layout', '' ); |
| 1231 | if ( $no_mobile !== '' ) { |
| 1232 | $options['noMobile'] = true; |
| 1233 | } |
| 1234 | |
| 1235 | $show_fullscreen_button = foogallery_gallery_template_setting( 'lightbox_show_fullscreen_button', false ); |
| 1236 | if ( $show_fullscreen_button !== false ) { |
| 1237 | $options['buttons']['fullscreen'] = ($show_fullscreen_button === 'yes'); |
| 1238 | } |
| 1239 | |
| 1240 | $show_maximise_button = foogallery_gallery_template_setting( 'lightbox_show_maximize_button', false ); |
| 1241 | if ( $show_maximise_button !== false ) { |
| 1242 | $options['buttons']['maximize'] = ($show_maximise_button === 'yes'); |
| 1243 | } |
| 1244 | |
| 1245 | $show_caption_button = foogallery_gallery_template_setting( 'lightbox_show_caption_button', false ); |
| 1246 | if ( $show_caption_button !== false ) { |
| 1247 | $options['buttons']['info'] = ($show_caption_button === 'yes'); |
| 1248 | } |
| 1249 | |
| 1250 | $show_thumbstrip_button = foogallery_gallery_template_setting( 'lightbox_show_thumbstrip_button', false ); |
| 1251 | if ( $show_thumbstrip_button !== false ) { |
| 1252 | $options['buttons']['thumbs'] = ($show_thumbstrip_button === 'yes'); |
| 1253 | } |
| 1254 | |
| 1255 | $show_download_button = foogallery_gallery_template_setting( 'lightbox_show_download_button', false ); |
| 1256 | if ( $show_download_button !== false ) { |
| 1257 | $options['buttons']['download'] = ( $show_download_button === 'yes' ); |
| 1258 | } |
| 1259 | |
| 1260 | $show_nav_buttons = foogallery_gallery_template_setting( 'lightbox_show_nav_buttons', 'yes' ); |
| 1261 | if ( $show_nav_buttons !== 'yes' ) { |
| 1262 | $options['buttons']['prev'] = $options['buttons']['next'] = false; |
| 1263 | } |
| 1264 | |
| 1265 | $autoplay = foogallery_gallery_template_setting( 'video_autoplay', 'yes' ); |
| 1266 | if ( 'yes' === $autoplay ) { |
| 1267 | $options['video']['autoPlay'] = true; |
| 1268 | } |
| 1269 | |
| 1270 | return apply_filters( 'foogallery_lightbox_data_attributes', $options ); |
| 1271 | } |
| 1272 | |
| 1273 | /** |
| 1274 | * Override the lightbox field for albums only |
| 1275 | * |
| 1276 | * @param $field |
| 1277 | * @param $object |
| 1278 | */ |
| 1279 | function alter_gallery_template_field( $field, $object ) { |
| 1280 | if ( is_a( $object, 'FooGalleryAlbum' ) ) { |
| 1281 | if ( array_key_exists( 'lightbox', $field ) ) { |
| 1282 | unset( $field['choices']['foogallery'] ); |
| 1283 | } |
| 1284 | } |
| 1285 | |
| 1286 | return $field; |
| 1287 | } |
| 1288 | } |
| 1289 | } |
| 1290 |