Skip to content

Commit

Permalink
#2731 Added in master
Browse files Browse the repository at this point in the history
  • Loading branch information
MARQAS committed Jan 29, 2019
1 parent 3a9b149 commit 44a3dc3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
8 changes: 8 additions & 0 deletions includes/options/admin-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6117,6 +6117,14 @@ function ampforwp_get_element_default_color() {

),
),
array(
'id' => 'ampforwp-gallery-lightbox',
'type' => 'switch',
'title' => esc_html__('Lightbox for Gallery', 'accelerated-mobile-pages'),
'class' => 'child_opt child_opt_arrow',
'default' => 1,
'required' => array('ampforwp-gallery-design-type' , '!=' , '3'),
),
array(
'id' => 'single-sneakp-section',
'type' => 'section',
Expand Down
32 changes: 19 additions & 13 deletions includes/vendor/amp/includes/embeds/class-amp-gallery-embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,23 @@ public function render( $args ) {

/*Filter*/
$carousel_markup = '';
$carousel_markup = $amp_image_lightbox = '';

$carousel_markup_all = array(
'1'=>array(
'main-html'=>'{{with_carousel}}',
'image-with-caption-html'=>'<figure><div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div><figcaption :openbrack:class:closebrack:="expanded? \'expanded\' : \'\'" on="tap:AMP.setState({expanded: !expanded})" tabindex="0" role="button" >{{main_images_caption}}<span :openbrack:text:closebrack:="expanded ? \'less\' : \'more\'">more</span> </figcaption></figure>',
'main-html'=>'{{with_carousel}}
{{amp_image_lightbox}}',
'image-with-caption-html'=>'<figure><div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div><figcaption {{openbrack}}class{{closebrack}}="expanded? \'expanded\' : \'\'" on="tap:AMP.setState({expanded: !expanded})" tabindex="0" role="button" >{{main_images_caption}}<span {{openbrack}}text{{closebrack}}="expanded ? \'less\' : \'more\'">more</span> </figcaption></figure>',
'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
'gallery_css' => '',

'scripts' => array()
),
'2' => array(
'main-html'=>'{{with_carousel}} {{with_carousel_thumbnail}}',
'image-with-caption-html'=>'<figure><div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div><figcaption :openbrack:class:closebrack:="expanded? \'expanded\' : \'\'" on="tap:AMP.setState({expanded: !expanded})" tabindex="0" role="button" >{{main_images_caption}}<span :openbrack:text:closebrack:="expanded ? \'less\' : \'more\'">more</span> </figcaption></figure>',
'main-html'=>'{{with_carousel}}
{{with_carousel_thumbnail}}
{{amp_image_lightbox}}',
'image-with-caption-html'=>'<figure><div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div><figcaption {{openbrack}}class{{closebrack}}="expanded? \'expanded\' : \'\'" on="tap:AMP.setState({expanded: !expanded})" tabindex="0" role="button" >{{main_images_caption}}<span {{openbrack}}text{{closebrack}}="expanded ? \'less\' : \'more\'">more</span> </figcaption></figure>',
'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
'carousel_with_thumbnail_html'=>'<button on="tap:carousel-with-carousel-preview-{{unique_id}}.goToSlide(index={{unique_index}})" class="amp-carousel-slide amp-scrollable-carousel-slide">{{thumbnail}}</button>',
'gallery_css' => '
Expand All @@ -137,14 +141,8 @@ public function render( $args ) {
'scripts' => array()
),
'3' => array(
'main-html'=>'<div class="wrapper">{{with_images}}</div>
<amp-image-lightbox id="gallery-lightbox" layout="nodisplay">
<div on="tap:gallery-lightbox.close" role="button"
tabindex="0">
<button class="cls-btn" on="tap:gallery-lightbox.close"
role="button" tabindex="0"></button>
</div>
</amp-image-lightbox>',
'main-html'=>'<div class="gal_w">{{with_images}}</div>
{{amp_image_lightbox}}',
'image-with-caption-html'=>'',
'image-without-caption-html' =>'{{main_images}}',
'gallery_css' => '
Expand Down Expand Up @@ -177,10 +175,17 @@ public function render( $args ) {
'layout' => 'fill',
'class' => 'amp-carousel-img',
);
if( isset($redux_builder_amp['ampforwp-gallery-design-type']) && $redux_builder_amp['ampforwp-gallery-design-type'] == 3 ){
if( 3 == ampforwp_get_setting('ampforwp-gallery-design-type') || true == ampforwp_get_setting('ampforwp-gallery-lightbox') ){
$design3_additional_attr = array('on'=> 'tap:gallery-lightbox', 'role'=>'button',
'tabindex'=>$key);
$amp_img_arr = array_merge($amp_img_arr, $design3_additional_attr);
$amp_image_lightbox = '<amp-image-lightbox id="gallery-lightbox" layout="nodisplay">
<div on="tap:gallery-lightbox.close" role="button"
tabindex="0">
<button class="cls-btn" on="tap:gallery-lightbox.close"
role="button" tabindex="0"></button>
</div>
</amp-image-lightbox>';
}
$amp_images[$key] = AMP_HTML_Utils::build_tag(
'amp-img',
Expand Down Expand Up @@ -248,6 +253,7 @@ public function render( $args ) {
//last changes
$returnCompleteHtml = str_replace('{{with_carousel}}', $amp_carousel, $returnCompleteHtml);
$returnCompleteHtml = str_replace('{{with_carousel_thumbnail}}', $amp_carousel_thumbnail, $returnCompleteHtml);
$returnCompleteHtml = str_replace('{{amp_image_lightbox}}', $amp_image_lightbox, $returnCompleteHtml);
$returnCompleteHtml = str_replace('{{with_images}}', implode( PHP_EOL, $images ), $returnCompleteHtml);
return $returnCompleteHtml;
}
Expand Down

0 comments on commit 44a3dc3

Please sign in to comment.