From 86e4690b5f4c5e8ac765b034c1ef25ef4a1669c6 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 24 Apr 2018 20:42:23 -0400 Subject: [PATCH] [frio] Add background-repeat attribute to background image options - Update background image options names and labels - Add background image option label tag --- view/theme/frio/config.php | 5 +++-- view/theme/frio/css/style.css | 1 + view/theme/frio/php/Image.php | 8 ++++---- view/theme/frio/style.php | 7 +++++++ view/theme/frio/templates/theme_settings.tpl | 1 + 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index e9594b009..26f725f25 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -111,7 +111,7 @@ function frio_form($arr) } } - $background_image_help = '' . L10n::t('Note') . ': ' . L10n::t('Check image permissions if all users are allowed to visit the image'); + $background_image_help = '' . L10n::t('Note') . ': ' . L10n::t('Check image permissions if all users are allowed to see the image'); $t = get_markup_template('theme_settings.tpl'); $ctx = [ @@ -123,8 +123,9 @@ function frio_form($arr) '$nav_icon_color' => array_key_exists('nav_icon_color', $disable) ? '' : ['frio_nav_icon_color', L10n::t('Navigation bar icon color '), $arr['nav_icon_color'], '', false], '$link_color' => array_key_exists('link_color', $disable) ? '' : ['frio_link_color', L10n::t('Link color'), $arr['link_color'], '', false], '$background_color' => array_key_exists('background_color', $disable) ? '' : ['frio_background_color', L10n::t('Set the background color'), $arr['background_color'], '', false], - '$contentbg_transp' => array_key_exists('contentbg_transp', $disable) ? '' : ['frio_contentbg_transp', L10n::t('Content background opacity'), ((isset($arr['contentbg_transp']) && $arr['contentbg_transp'] != '') ? $arr['contentbg_transp'] : 100), ''], + '$contentbg_transp' => array_key_exists('contentbg_transp', $disable) ? '' : ['frio_contentbg_transp', L10n::t('Content background opacity'), defaults($arr, 'contentbg_transp', 100), ''], '$background_image' => array_key_exists('background_image', $disable) ? '' : ['frio_background_image', L10n::t('Set the background image'), $arr['background_image'], $background_image_help, false], + '$bg_image_options_title' => L10n::t('Background image style'), '$bg_image_options' => Image::get_options($arr), ]; diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 839aa9ac3..912c6a884 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -27,6 +27,7 @@ body { background-color: $background_color; background-image: url("$background_image"); background-size: $background_size_img; + background-repeat: $background_repeat; background-attachment: fixed; color: #777; /*color: #555;*/ diff --git a/view/theme/frio/php/Image.php b/view/theme/frio/php/Image.php index 2b3cf3be8..b1877393b 100644 --- a/view/theme/frio/php/Image.php +++ b/view/theme/frio/php/Image.php @@ -21,10 +21,10 @@ class Image public static function get_options($arr) { $bg_image_options = [ - 'repeat' => ['frio_bg_image_option', L10n::t('Repeat the image'), 'repeat', L10n::t('Will repeat your image to fill the background.'), ($arr['bg_image_option'] == 'repeat')], - 'stretch' => ['frio_bg_image_option', L10n::t('Stretch'), 'stretch', L10n::t('Will stretch to width/height of the image.'), ($arr['bg_image_option'] == 'stretch')], - 'cover' => ['frio_bg_image_option', L10n::t('Resize fill and-clip'), 'cover', L10n::t('Resize to fill and retain aspect ratio.'), ($arr['bg_image_option'] == 'cover')], - 'contain' => ['frio_bg_image_option', L10n::t('Resize best fit'), 'contain', L10n::t('Resize to best fit and retain aspect ratio.'), ($arr['bg_image_option'] == 'contain')], + 'stretch' => ['frio_bg_image_option', L10n::t("Stretch"), "stretch", L10n::t("Resize image to the width of the screen and show background color below on long pages."), ($arr["bg_image_option"] == "stretch")], + 'cover' => ['frio_bg_image_option', L10n::t("Resize, fill and clip"), "cover", L10n::t("Resize image to fill entire screen, clipping either the right or the bottom."), ($arr["bg_image_option"] == "cover")], + 'repeat' => ['frio_bg_image_option', L10n::t("Repeat"), "repeat", L10n::t("Repeat image to fill the screen."), ($arr["bg_image_option"] == "repeat")], + 'contain' => ['frio_bg_image_option', L10n::t("Repeat one row"), "contain", L10n::t("Resize image to repeat it on a single row, either vertical or horizontal."), ($arr["bg_image_option"] == "contain")], ]; return $bg_image_options; diff --git a/view/theme/frio/style.php b/view/theme/frio/style.php index 811db092a..393dca2f9 100644 --- a/view/theme/frio/style.php +++ b/view/theme/frio/style.php @@ -152,22 +152,28 @@ if (!isset($link_hover_color)) { if (!isset($bg_image_option)) { $bg_image_option = null; } + switch ($bg_image_option) { case 'stretch': $background_size_img = '100%'; + $background_repeat = 'no-repeat'; break; case 'cover': $background_size_img = 'cover'; + $background_repeat = 'no-repeat'; break; case 'repeat': $background_size_img = 'auto'; + $background_repeat = 'repeat'; break; case 'contain': $background_size_img = 'contain'; + $background_repeat = 'repeat'; break; default: $background_size_img = 'auto'; + $background_repeat = 'no-repeat'; break; } @@ -187,6 +193,7 @@ $options = [ '$contentbg_transp' => $contentbg_transp, '$background_image' => $background_image, '$background_size_img' => $background_size_img, + '$background_repeat' => $background_repeat, '$login_bg_image' => $login_bg_image, '$login_bg_color' => $login_bg_color ]; diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index f524dd6e0..50a8934d1 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -25,6 +25,7 @@ {{if $background_image}}{{include file="field_fileinput.tpl" field=$background_image}}{{/if}}