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

FDSU-1829: Adding image styles to the homepage banners, setting fonts for the homepage banners.

parent 3cae9124
...@@ -14,6 +14,15 @@ ...@@ -14,6 +14,15 @@
display: none; display: none;
} }
@font-face {
font-family: "Typ1451-Regular";
src:url("/fonts/lineto-typ1451-regular.eot");
src:url("/fonts/lineto-typ1451-regular.eot?#iefix") format("embedded-opentype"),
url("/fonts/lineto-typ1451-regular.woff2") format("woff2"),
url("/fonts/lineto-typ1451-regular.woff") format("woff");
font-weight: normal;
font-style: normal;
}
.homepage_banners_paginator { .homepage_banners_paginator {
display: flex; display: flex;
......
...@@ -438,9 +438,18 @@ function uw_virtual_site_homepage_field_default_field_instances() { ...@@ -438,9 +438,18 @@ function uw_virtual_site_homepage_field_default_field_instances() {
), ),
'retroactive_update' => 0, 'retroactive_update' => 0,
), ),
'image_field_caption' => array(
'enabled' => 1,
),
'image_field_caption_wrapper' => array(
'image_field_caption_default' => array(
'format' => 'filtered_html',
'value' => '',
),
),
'max_filesize' => '', 'max_filesize' => '',
'max_resolution' => '', 'max_resolution' => '',
'min_resolution' => '', 'min_resolution' => '1200x400',
'title_field' => 1, 'title_field' => 1,
'title_field_required' => 0, 'title_field_required' => 0,
'user_register_form' => FALSE, 'user_register_form' => FALSE,
...@@ -818,6 +827,15 @@ function uw_virtual_site_homepage_field_default_field_instances() { ...@@ -818,6 +827,15 @@ function uw_virtual_site_homepage_field_default_field_instances() {
), ),
'retroactive_update' => 0, 'retroactive_update' => 0,
), ),
'image_field_caption' => array(
'enabled' => 0,
),
'image_field_caption_wrapper' => array(
'image_field_caption_default' => array(
'format' => 'filtered_html',
'value' => '',
),
),
'max_filesize' => '10 MB', 'max_filesize' => '10 MB',
'max_resolution' => '', 'max_resolution' => '',
'min_resolution' => '360x480', 'min_resolution' => '360x480',
......
...@@ -20,6 +20,150 @@ function uw_virtual_site_homepage_views_api($module = NULL, $api = NULL) { ...@@ -20,6 +20,150 @@ function uw_virtual_site_homepage_views_api($module = NULL, $api = NULL) {
return array("api" => "3.0"); return array("api" => "3.0");
} }
/**
* Implements hook_image_default_styles().
*/
function uw_virtual_site_homepage_image_default_styles() {
$styles = array();
// Exported image style: uw_homepage_banners.
$styles['uw_homepage_banners'] = array(
'name' => 'uw_homepage_banners',
'label' => 'Homepage banners',
'effects' => array(
5 => array(
'label' => 'Focal Point Scale And Crop',
'help' => 'Scale and crop based on data provided by <em>Focal Point</em>.',
'effect callback' => 'focal_point_scale_and_crop_effect',
'dimensions callback' => 'image_resize_dimensions',
'form callback' => 'focal_point_crop_form',
'summary theme' => 'focal_point_image_resize_summary',
'module' => 'focal_point',
'name' => 'focal_point_scale_and_crop',
'data' => array(
'width' => 380,
'height' => 320,
'focal_point_advanced' => array(
'shift_x' => '',
'shift_y' => '',
),
),
'weight' => 1,
),
),
);
// Exported image style: uw_homepage_banners_large.
$styles['uw_homepage_banners_large'] = array(
'name' => 'uw_homepage_banners_large',
'label' => 'Homepage banners large',
'effects' => array(
3 => array(
'label' => 'Focal Point Scale And Crop',
'help' => 'Scale and crop based on data provided by <em>Focal Point</em>.',
'effect callback' => 'focal_point_scale_and_crop_effect',
'dimensions callback' => 'image_resize_dimensions',
'form callback' => 'focal_point_crop_form',
'summary theme' => 'focal_point_image_resize_summary',
'module' => 'focal_point',
'name' => 'focal_point_scale_and_crop',
'data' => array(
'width' => 1000,
'height' => 600,
'focal_point_advanced' => array(
'shift_x' => '',
'shift_y' => '',
),
),
'weight' => 1,
),
),
);
// Exported image style: uw_homepage_banners_medium.
$styles['uw_homepage_banners_medium'] = array(
'name' => 'uw_homepage_banners_medium',
'label' => 'Homepage banners medium',
'effects' => array(
2 => array(
'label' => 'Focal Point Scale And Crop',
'help' => 'Scale and crop based on data provided by <em>Focal Point</em>.',
'effect callback' => 'focal_point_scale_and_crop_effect',
'dimensions callback' => 'image_resize_dimensions',
'form callback' => 'focal_point_crop_form',
'summary theme' => 'focal_point_image_resize_summary',
'module' => 'focal_point',
'name' => 'focal_point_scale_and_crop',
'data' => array(
'width' => 800,
'height' => 400,
'focal_point_advanced' => array(
'shift_x' => '',
'shift_y' => '',
),
),
'weight' => 1,
),
),
);
// Exported image style: uw_homepage_banners_small.
$styles['uw_homepage_banners_small'] = array(
'name' => 'uw_homepage_banners_small',
'label' => 'Homepage banners small',
'effects' => array(
1 => array(
'label' => 'Focal Point Scale And Crop',
'help' => 'Scale and crop based on data provided by <em>Focal Point</em>.',
'effect callback' => 'focal_point_scale_and_crop_effect',
'dimensions callback' => 'image_resize_dimensions',
'form callback' => 'focal_point_crop_form',
'summary theme' => 'focal_point_image_resize_summary',
'module' => 'focal_point',
'name' => 'focal_point_scale_and_crop',
'data' => array(
'width' => 480,
'height' => 480,
'focal_point_advanced' => array(
'shift_x' => '',
'shift_y' => '',
),
),
'weight' => 1,
),
),
);
// Exported image style: uw_homepage_banners_xl.
$styles['uw_homepage_banners_xl'] = array(
'name' => 'uw_homepage_banners_xl',
'label' => 'Homepage banners xl',
'effects' => array(
4 => array(
'label' => 'Focal Point Scale And Crop',
'help' => 'Scale and crop based on data provided by <em>Focal Point</em>.',
'effect callback' => 'focal_point_scale_and_crop_effect',
'dimensions callback' => 'image_resize_dimensions',
'form callback' => 'focal_point_crop_form',
'summary theme' => 'focal_point_image_resize_summary',
'module' => 'focal_point',
'name' => 'focal_point_scale_and_crop',
'data' => array(
'width' => 1600,
'height' => 553,
'focal_point_advanced' => array(
'shift_x' => '',
'shift_y' => '',
),
),
'weight' => 1,
),
),
);
return $styles;
}
/** /**
* Implements hook_node_info(). * Implements hook_node_info().
*/ */
......
...@@ -19,6 +19,7 @@ dependencies[] = strongarm ...@@ -19,6 +19,7 @@ dependencies[] = strongarm
dependencies[] = text dependencies[] = text
dependencies[] = views dependencies[] = views
dependencies[] = vsite_vocab dependencies[] = vsite_vocab
stylesheets[all][] = css/uw_virtual_site_homepage.css
features[ctools][] = strongarm:strongarm:1 features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0 features[ctools][] = views:views_default:3.0
features[features_api][] = api:2 features[features_api][] = api:2
...@@ -49,6 +50,11 @@ features[field_instance][] = node-uw_virtual_site_homepage-field_uw_profile_imag ...@@ -49,6 +50,11 @@ features[field_instance][] = node-uw_virtual_site_homepage-field_uw_profile_imag
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_site_description features[field_instance][] = node-uw_virtual_site_homepage-field_uw_site_description
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_theme_settings features[field_instance][] = node-uw_virtual_site_homepage-field_uw_theme_settings
features[field_instance][] = node-uw_virtual_site_homepage-og_group_ref features[field_instance][] = node-uw_virtual_site_homepage-og_group_ref
features[image][] = uw_homepage_banners
features[image][] = uw_homepage_banners_large
features[image][] = uw_homepage_banners_medium
features[image][] = uw_homepage_banners_small
features[image][] = uw_homepage_banners_xl
features[node][] = uw_virtual_site_homepage features[node][] = uw_virtual_site_homepage
features[user_permission][] = create uw_virtual_site_homepage content features[user_permission][] = create uw_virtual_site_homepage content
features[user_permission][] = delete any uw_virtual_site_homepage content features[user_permission][] = delete any uw_virtual_site_homepage content
...@@ -69,4 +75,4 @@ features[variable][] = node_preview_uw_virtual_site_homepage ...@@ -69,4 +75,4 @@ features[variable][] = node_preview_uw_virtual_site_homepage
features[variable][] = node_submitted_uw_virtual_site_homepage features[variable][] = node_submitted_uw_virtual_site_homepage
features[views_view][] = uw_virtual_site_homepage_view features[views_view][] = uw_virtual_site_homepage_view
features_exclude[menu_links][navigation_uw-virtual-site-homepage:node/add/uw-virtual-site-homepage] = navigation_uw-virtual-site-homepage:node/add/uw-virtual-site-homepage features_exclude[menu_links][navigation_uw-virtual-site-homepage:node/add/uw-virtual-site-homepage] = navigation_uw-virtual-site-homepage:node/add/uw-virtual-site-homepage
mtime = 1484853749 mtime = 1485179712
...@@ -29,8 +29,8 @@ function uw_virtual_site_homepage_field_widget_form_alter(&$element, &$form_stat ...@@ -29,8 +29,8 @@ function uw_virtual_site_homepage_field_widget_form_alter(&$element, &$form_stat
*/ */
function uw_virtual_site_homepage_image_field_widget_process($element, &$form_state, $form) { function uw_virtual_site_homepage_image_field_widget_process($element, &$form_state, $form) {
// Set the title to be the caption and the description. // Set the title to be the caption and the description.
$element['title']['#title'] = 'Caption'; //$element['title']['#title'] = 'Caption';
$element['title']['#description'] = 'The caption is display with the picture.'; $element['title']['#description'] = 'The title is display with the picture.';
// Return the altered element // Return the altered element
return $element; return $element;
...@@ -42,7 +42,7 @@ function uw_virtual_site_homepage_image_field_widget_process($element, &$form_st ...@@ -42,7 +42,7 @@ function uw_virtual_site_homepage_image_field_widget_process($element, &$form_st
*/ */
function uw_virtual_site_homepage_page_alter(&$page) { function uw_virtual_site_homepage_page_alter(&$page) {
drupal_add_css(drupal_get_path('module', 'uw_virtual_site_homepage') . '/css/uw_virtual_site_homepage.css'); global $base_path;
// Setting the variables to be used in homepage banners. // Setting the variables to be used in homepage banners.
$index = 0; $index = 0;
...@@ -68,18 +68,41 @@ function uw_virtual_site_homepage_page_alter(&$page) { ...@@ -68,18 +68,41 @@ function uw_virtual_site_homepage_page_alter(&$page) {
// While there is a continue, process the homepage banners. // While there is a continue, process the homepage banners.
while($continue) { while($continue) {
// Set theme paths, alt text and all banner sizes.
$theme_path = $base_path . drupal_get_path('theme', 'uw_virtual_site_homepage');
$banner_alt = 'Test ALT';
$banner_small = image_style_url('uw_homepage_banners', $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['uri']);
$banner_square = image_style_url('uw_homepage_banners_small', $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['uri']);
$banner_med = image_style_url('uw_homepage_banners_medium', $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['uri']);
$banner_large = image_style_url('uw_homepage_banners_large', $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['uri']);
$banner_xl = image_style_url('uw_homepage_banners_xl', $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['uri']);
$pagenumber++; $pagenumber++;
// Set the image. // Set the image.
$html .= '<figure class="field-item uw-homepage-banners-figure">'; $html .= '<figure class="field-item uw-homepage-banners-figure">';
$html .= '<img src="' . file_uri_target($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['uri']) . '">';
// Set the picture using the picture tag.
$html .= '<picture>
<source srcset="' . $banner_xl .'" media="(min-width: 1280px)">
<source srcset="' . $banner_med . '" media="(min-width: 1024px)">
<source srcset="' . $banner_large . '" media="(min-width: 769px)">
<source srcset="' . $banner_square . '" media="(min-width: 480px)">
<source srcset="' . $banner_large . '" media="(min-width: 320px)">
<source srcset="' . $banner_large . '">
<img src="' . $banner_xl . '" alt="' . $banner_alt . '">
</picture>';
// If there is a title, double check, and then set the caption. // If there is a title, double check, and then set the caption.
if(isset($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'])) { if(isset($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'])) {
// If there is a title, set the caption. // If there is a title, set the caption.
if($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'] !== "") { if($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'] !== "") {
$html .= '<span class="banner-caption">' . $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'] . '</span>'; $html .= '<span class="banner-caption"><strong>' . $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'] . '</strong>';
if($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][0]['#item']['image_field_caption']) {
$html .= '<span>' . $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][0]['#item']['image_field_caption']['value'] . '</span>';
}
$html .= '</span>';
} }
} }
...@@ -138,8 +161,6 @@ function uw_virtual_site_homepage_page_alter(&$page) { ...@@ -138,8 +161,6 @@ function uw_virtual_site_homepage_page_alter(&$page) {
function uw_virtual_site_homepage_form_uw_virtual_site_homepage_node_form_alter(&$form, &$form_state, $form_id) { function uw_virtual_site_homepage_form_uw_virtual_site_homepage_node_form_alter(&$form, &$form_state, $form_id) {
global $base_path; global $base_path;
drupal_add_css(drupal_get_path('module', 'uw_virtual_site_homepage') . '/css/uw_virtual_site_homepage.css');
// Get current link. // Get current link.
$url = request_uri(); $url = request_uri();
...@@ -239,7 +260,7 @@ function uw_virtual_site_homepage_form_uw_virtual_site_homepage_node_form_alter( ...@@ -239,7 +260,7 @@ function uw_virtual_site_homepage_form_uw_virtual_site_homepage_node_form_alter(
* The validate buttons by adding css in order to remove duplicate buttons. * The validate buttons by adding css in order to remove duplicate buttons.
*/ */
function uw_virtual_site_homepage_button_validate(&$form, &$form_state) { function uw_virtual_site_homepage_button_validate(&$form, &$form_state) {
drupal_add_css(drupal_get_path('module', 'uw_virtual_site_homepage') . '/css/uw_virtual_site_homepage.css');
} }
/** /**
......
Supports Markdown
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