Commit cb4cc073 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-42: Adding link title displaying if there is not title or caption set in homepage banners.

parent 9ae8e77d
...@@ -119,6 +119,7 @@ function uw_virtual_site_homepage_page_alter(&$page) { ...@@ -119,6 +119,7 @@ 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_image'][0]['#item']['title'])) { if(isset($page['uw-virtual-site-homepage']['field_uw_homepage_banners'][$index]['entity']['field_collection_item'][$fc_id]['field_uw_homepage_banners_image'][0]['#item']['title'])) {
// If there is a title, set the caption. // If there is a title, set the caption.
// If there is not title, check that there is a title for the link and use that.
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'] !== "") { 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-wrapper">';
$html .= '<div class="banner-caption">'; $html .= '<div class="banner-caption">';
...@@ -129,6 +130,13 @@ function uw_virtual_site_homepage_page_alter(&$page) { ...@@ -129,6 +130,13 @@ function uw_virtual_site_homepage_page_alter(&$page) {
$html .= '</div>'; $html .= '</div>';
$html .= '</div>'; $html .= '</div>';
} }
elseif (isset($page['uw-virtual-site-homepage']['field_uw_homepage_banners'][$index]['entity']['field_collection_item'][$fc_id]['field_uw_homepage_banners_link']['#items'][0]['title'])) {
$html .= '<div class="banner-caption-wrapper">';
$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_link']['#items'][0]['title'] . '</h2>';
$html .= '</div>';
$html .= '</div>';
}
} }
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'])) { 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'])) {
......
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