Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
wcms-openscholar
uw_virtual_site_homepage
Commits
22a27317
Commit
22a27317
authored
Jan 24, 2017
by
Eric Bremner
Browse files
FDSU-1829: Reducing JS code and ensuring that homepage banner without link functions correctly.
parent
a8c2a74c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
74 deletions
+67
-74
css/uw_virtual_site_homepage.css
css/uw_virtual_site_homepage.css
+22
-22
uw_virtual_site_homepage.module
uw_virtual_site_homepage.module
+45
-52
No files found.
css/uw_virtual_site_homepage.css
View file @
22a27317
...
...
@@ -128,14 +128,14 @@ button.slideshow-control.play::before {
}
/***** HOMEPAGE BANNERS CAPTION TEXT ******/
.homepage-banners-top-wrapper.default
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.default
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.default
button
.slideshow-control
,
.homepage-banners-top-wrapper.default
.tabs-previous
,
.homepage-banners-top-wrapper.default
.tabs-next
{
color
:
#E4B429
;
}
.homepage-banners-top-wrapper.default
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.default
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.default
button
.slideshow-control
{
background-color
:
rgba
(
0
,
0
,
0
,
.8
);
}
...
...
@@ -148,14 +148,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
228
,
180
,
41
,
.8
);
}
.homepage-banners-top-wrapper.arts
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.arts
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.arts
button
.slideshow-control
,
.homepage-banners-top-wrapper.arts
.tabs-previous
,
.homepage-banners-top-wrapper.arts
.tabs-next
{
color
:
#FFD5A5
;
}
.homepage-banners-top-wrapper.arts
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.arts
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.arts
button
.slideshow-control
{
background-color
:
rgba
(
217
,
63
,
0
,
.8
);
}
...
...
@@ -168,14 +168,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
255
,
213
,
165
,
.8
);
}
.homepage-banners-top-wrapper.ahs
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.ahs
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.ahs
button
.slideshow-control
,
.homepage-banners-top-wrapper.ahs
.tabs-previous
,
.homepage-banners-top-wrapper.ahs
.tabs-next
{
color
:
#97DFEF
;
}
.homepage-banners-top-wrapper.ahs
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.ahs
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.ahs
button
.slideshow-control
{
background-color
:
rgba
(
0
,
89
,
99
,
.8
);
}
...
...
@@ -188,14 +188,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
151
,
223
,
239
,
.8
);
}
.homepage-banners-top-wrapper.engineering
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.engineering
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.engineering
button
.slideshow-control
,
.homepage-banners-top-wrapper.engineering
.tabs-previous
,
.homepage-banners-top-wrapper.engineering
.tabs-next
{
color
:
#D0B4EF
;
}
.homepage-banners-top-wrapper.engineering
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.engineering
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.engineering
button
.slideshow-control
{
background-color
:
rgba
(
87
,
5
,
139
,
.8
);
}
...
...
@@ -208,14 +208,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
208
,
180
,
239
,
.8
);
}
.homepage-banners-top-wrapper.environment
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.environment
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.environment
button
.slideshow-control
,
.homepage-banners-top-wrapper.environment
.tabs-previous
,
.homepage-banners-top-wrapper.environment
.tabs-next
{
color
:
#DAF582
;
}
.homepage-banners-top-wrapper.environment
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.environment
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.environment
button
.slideshow-control
{
background-color
:
rgba
(
96
,
112
,
0
,
.8
);
}
...
...
@@ -228,14 +228,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
218
,
245
,
130
,
.8
);
}
.homepage-banners-top-wrapper.math
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.math
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.math
button
.slideshow-control
,
.homepage-banners-top-wrapper.math
.tabs-previous
,
.homepage-banners-top-wrapper.math
.tabs-next
{
color
:
#FFBEEF
;
}
.homepage-banners-top-wrapper.math
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.math
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.math
button
.slideshow-control
{
background-color
:
rgba
(
198
,
0
,
120
,
.8
);
}
...
...
@@ -248,14 +248,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
255
,
190
,
239
,
.8
);
}
.homepage-banners-top-wrapper.science
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.science
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.science
button
.slideshow-control
,
.homepage-banners-top-wrapper.science
.tabs-previous
,
.homepage-banners-top-wrapper.science
.tabs-next
{
color
:
#97DFEF
;
}
.homepage-banners-top-wrapper.science
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.science
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.science
button
.slideshow-control
{
background-color
:
rgba
(
0
,
51
,
190
,
.8
);
}
...
...
@@ -268,14 +268,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
180
,
213
,
255
,
.8
);
}
.homepage-banners-top-wrapper.cgc
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.cgc
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.cgc
button
.slideshow-control
,
.homepage-banners-top-wrapper.cgc
.tabs-previous
,
.homepage-banners-top-wrapper.cgc
.tabs-next
{
color
:
#FFA5AA
;
}
.homepage-banners-top-wrapper.cgc
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.cgc
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.cgc
button
.slideshow-control
{
background-color
:
rgba
(
128
,
0
,
31
,
.8
);
}
...
...
@@ -288,14 +288,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
255
,
165
,
170
,
.8
);
}
.homepage-banners-top-wrapper.ren
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.ren
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.ren
button
.slideshow-control
,
.homepage-banners-top-wrapper.ren
.tabs-previous
,
.homepage-banners-top-wrapper.ren
.tabs-next
{
color
:
#FFA5AA
;
}
.homepage-banners-top-wrapper.ren
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.ren
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.ren
button
.slideshow-control
{
background-color
:
rgba
(
128
,
0
,
31
,
.8
);
}
...
...
@@ -308,14 +308,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
255
,
165
,
170
,
.8
);
}
.homepage-banners-top-wrapper.stj
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.stj
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.stj
button
.slideshow-control
,
.homepage-banners-top-wrapper.stj
.tabs-previous
,
.homepage-banners-top-wrapper.stj
.tabs-next
{
color
:
#FFA5AA
;
}
.homepage-banners-top-wrapper.stj
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.stj
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.stj
button
.slideshow-control
{
background-color
:
rgba
(
128
,
0
,
31
,
.8
);
}
...
...
@@ -328,14 +328,14 @@ button.slideshow-control.play::before {
background-color
:
rgba
(
255
,
165
,
170
,
.8
);
}
.homepage-banners-top-wrapper.stp
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.stp
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.stp
button
.slideshow-control
,
.homepage-banners-top-wrapper.stp
.tabs-previous
,
.homepage-banners-top-wrapper.stp
.tabs-next
{
color
:
#FFA5AA
;
}
.homepage-banners-top-wrapper.stp
.uw-homepage-banners-figure
a
.banner-caption
,
.homepage-banners-top-wrapper.stp
.uw-homepage-banners-figure
.banner-caption
,
.homepage-banners-top-wrapper.stp
button
.slideshow-control
{
background-color
:
rgba
(
128
,
0
,
31
,
.8
);
}
...
...
uw_virtual_site_homepage.module
View file @
22a27317
...
...
@@ -65,14 +65,6 @@ 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
)
{
...
...
@@ -94,7 +86,12 @@ function uw_virtual_site_homepage_page_alter(&$page) {
$pagenumber
++
;
// Set the image.
$html
.
=
'<figure class="field-item uw-homepage-banners-figure">'
;
if
(
$pagenumber
==
1
)
{
$html
.
=
'<figure class="field-item uw-homepage-banners-figure element-selected">'
;
}
else
{
$html
.
=
'<figure class="field-item uw-homepage-banners-figure element-invisible">'
;
}
if
(
isset
(
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_link'
][
'#items'
][
0
][
'url'
]))
{
$html
.
=
'<a href="'
.
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_link'
][
'#items'
][
0
][
'url'
]
.
'">'
;
...
...
@@ -110,12 +107,13 @@ function uw_virtual_site_homepage_page_alter(&$page) {
<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">'
;
}
//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
.
=
'</picture>'
;
...
...
@@ -125,7 +123,8 @@ function uw_virtual_site_homepage_page_alter(&$page) {
// If there is a title, set the caption.
if
(
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_image'
][
0
][
'#item'
][
'title'
]
!==
""
)
{
$html
.
=
'<div class="banner-caption-wrapper">'
;
$html
.
=
'<div class="banner-caption"><h2>'
.
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_image'
][
0
][
'#item'
][
'title'
]
.
'</h2>'
;
$html
.
=
'<div class="banner-caption">'
;
$html
.
=
'<h2>'
.
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_image'
][
0
][
'#item'
][
'title'
]
.
'</h2>'
;
if
(
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_image'
][
0
][
'#item'
][
'image_field_caption'
][
'value'
])
{
$html
.
=
'<span>'
.
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_image'
][
0
][
'#item'
][
'image_field_caption'
][
'value'
]
.
'</span>'
;
}
...
...
@@ -134,8 +133,26 @@ function uw_virtual_site_homepage_page_alter(&$page) {
}
}
if
(
isset
(
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_link'
][
'#items'
][
0
][
'url'
]))
{
$html
.
=
'</a>'
;
if
(
isset
(
$page
[
'uw-virtual-site-homepage'
][
'field_uw_homepage_banners'
][
$index
][
'entity'
][
'field_collection_item'
][
$fc_id
][
'field_uw_homepage_banners_link'
][
'#items'
][
0
][
'url'
]))
{
$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.
...
...
@@ -145,42 +162,18 @@ 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>'
;
}
}
}
// 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>'
;
}
// 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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment