Commit 82d37349 authored by Eric Bremner's avatar Eric Bremner
Browse files

FDSU-1829: Putting back code for only one homepage banner.

parent 5f414670
......@@ -64,6 +64,14 @@ function uw_virtual_site_homepage_page_alter(&$page) {
$pagenumber = 0;
$boxes = '';
$num_of_images = 0;
// Get the number of images in the homepage banners.
foreach($page['uw-virtual-site-homepage']['field_uw_homepage_banners'] as $key => $value) {
if(is_int($key)) {
$num_of_images++;
}
}
// While there is a continue, process the homepage banners.
while($continue) {
......@@ -104,16 +112,7 @@ function uw_virtual_site_homepage_page_alter(&$page) {
<source srcset="' . $banner_square . '" media="(min-width: 480px)">
<source srcset="' . $banner_large . '" media="(min-width: 320px)">
<source srcset="' . $banner_large . '">';
// If the first image, make visible, otherwise make invisible.
//if($pagenumber == 1) {
//$html .= '<img src="' . $banner_xl . '" alt="' . $banner_alt . '" class="element-selected">';
//}
//else {
//$html .= '<img src="' . $banner_xl . '" alt="' . $banner_alt . '" class="element-invisible">';
$html .= '<img src="' . $banner_xl . '" alt="' . $banner_alt . '">';
//}
$html .= '<img src="' . $banner_xl . '" alt="' . $banner_alt . '">';
$html .= '</picture>';
// If there is a title, double check, and then set the caption.
......@@ -136,24 +135,6 @@ function uw_virtual_site_homepage_page_alter(&$page) {
$html .= '</a>';
}
// More html.
$html .= '<div class="banner-controls">';
// Set previous and next buttons.
$html .= '<button id="previous_banner" class="tabs-previous"><</button>';
$html .= '<button id="next_banner" class="tabs-next">></button>';
// More html to close the homepage banners.
$html .= '</div>';
$html .= '</figure>';
if($pagenumber == 1) {
$boxes .= '<li><a href="" title="display banner #' . $pagenumber . '" class="hpb_selected" data-pagenumber="' . $pagenumber .'"><span class="element-invisible">Display banner #</span>' . $pagenumber . '</a></li>';
}
else {
$boxes .= '<li><a href="" title="display banner #' . $pagenumber . '" data-pagenumber="' . $pagenumber .'"><span class="element-invisible">Display banner #</span>' . $pagenumber . '</a></li>';
}
// Increment the index.
$index++;
......@@ -161,18 +142,42 @@ function uw_virtual_site_homepage_page_alter(&$page) {
if(!(isset($page['uw-virtual-site-homepage']['field_uw_homepage_banners'][$index]))) {
$continue = false;
}
// If there is more than one image add the paginator blocks.
if($num_of_images > 1) {
// More html.
$html .= '<div class="banner-controls">';
// Set previous and next buttons.
$html .= '<button id="previous_banner" class="tabs-previous"><</button>';
$html .= '<button id="next_banner" class="tabs-next">></button>';
// More html to close the homepage banners.
$html .= '</div>';
$html .= '</figure>';
if($pagenumber == 1) {
$boxes .= '<li><a href="" title="display banner #' . $pagenumber . '" class="hpb_selected" data-pagenumber="' . $pagenumber .'"><span class="element-invisible">Display banner #</span>' . $pagenumber . '</a></li>';
}
else {
$boxes .= '<li><a href="" title="display banner #' . $pagenumber . '" data-pagenumber="' . $pagenumber .'"><span class="element-invisible">Display banner #</span>' . $pagenumber . '</a></li>';
}
}
}
// Final closing html and play/pause button.
$html .= '</div>';
$html .= '<button class="slideshow-control pause" title="Pause">';
$html .= '<span class="element-invisible">Pause banner slideshow</span>';
$html .= '<span class="icon-pause"></span>';
$html .= '</button>';
$html .= '<ul class="homepage_banners_paginator">';
$html .= $boxes;
$html .= '</ul>';
$html .= '</div>';
// If there is more than one image, add the Play/Pause button.
if($num_of_images > 1) {
// Final closing html and play/pause button.
$html .= '</div>';
$html .= '<button class="slideshow-control pause" title="Pause">';
$html .= '<span class="element-invisible">Pause banner slideshow</span>';
$html .= '<span class="icon-pause"></span>';
$html .= '</button>';
$html .= '<ul class="homepage_banners_paginator">';
$html .= $boxes;
$html .= '</ul>';
$html .= '</div>';
}
// Set the html to the page variable.
$page['uw_virtual_page_homepage_banners_html'] = $html;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment