Skip to content

Commit c98fd28

Browse files
Banner Background
1 parent 9c54d66 commit c98fd28

File tree

2 files changed

+108
-19
lines changed

2 files changed

+108
-19
lines changed

astroid/astroid-framework/framework/elements/banner/banner.php

Lines changed: 54 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package Astroid Framework
45
* @author JoomDev https://www.joomdev.com
@@ -25,12 +26,13 @@
2526
$params = new JRegistry();
2627
$params->loadString($item->params);
2728

28-
$astroid_banner_visibility = $params->get('astroid_banner_visibility',"currentPage");
29-
if($astroid_banner_visibility =="currentPage"){
29+
$astroid_banner_visibility = $params->get('astroid_banner_visibility', "currentPage");
30+
if ($astroid_banner_visibility == "currentPage") {
3031
if ((isset($item->query['option']) && $item->query['option'] != $jinput->get('option', '')) || (isset($item->query['view']) && $item->query['view'] != $jinput->get('view', '')) || (isset($item->query['layout']) && $item->query['layout'] != $jinput->get('layout', ''))) {
3132
return;
3233
}
3334
}
35+
$style = [];
3436

3537
$astroid_banner_enabled = $params->get('astroid_banner_enabled');
3638
if ($astroid_banner_enabled) {
@@ -42,41 +44,74 @@
4244
$astroid_banner_title_tag = $params->get('astroid_banner_title_tag', 'h3');
4345
}
4446
$astroid_banner_bgcolor = $params->get('astroid_banner_bgcolor', '');
47+
4548
$astroid_banner_bgimage = $params->get('astroid_banner_bgimage', '');
49+
$astroid_banner_bgimage_position = $params->get('astroid_banner_bgimage_position', '');
50+
if ($astroid_banner_bgimage_position == 'custom') {
51+
$astroid_banner_bgimage_position_x = $params->get('astroid_banner_bgimage_position_x', '');
52+
$astroid_banner_bgimage_position_y = $params->get('astroid_banner_bgimage_position_y', '');
53+
if (!empty($astroid_banner_bgimage_position_x)) {
54+
$style[] = 'background-position-x:' . $astroid_banner_bgimage_position_x;
55+
}
56+
if (!empty($astroid_banner_bgimage_position_y)) {
57+
$style[] = 'background-position-y:' . $astroid_banner_bgimage_position_y;
58+
}
59+
} elseif (!empty($astroid_banner_bgimage_position)) {
60+
$style[] = 'background-position:' . $astroid_banner_bgimage_position;
61+
}
62+
$astroid_banner_bgimage_repeat = $params->get('astroid_banner_bgimage_repeat', '');
63+
if (!empty($astroid_banner_bgimage_repeat)) {
64+
$style[] = 'background-repeat:' . $astroid_banner_bgimage_repeat;
65+
}
66+
$astroid_banner_bgimage_size = $params->get('astroid_banner_bgimage_size', '');
67+
if ($astroid_banner_bgimage_size == 'custom') {
68+
$astroid_banner_bgimage_width = $params->get('astroid_banner_bgimage_width', '');
69+
if (!empty($astroid_banner_bgimage_width)) {
70+
$style[] = 'background-size:' . $astroid_banner_bgimage_width;
71+
}
72+
} elseif (!empty($astroid_banner_bgimage_size)) {
73+
$style[] = 'background-size:' . $astroid_banner_bgimage_size;
74+
}
75+
76+
$astroid_banner_bgimage_attachment = $params->get('astroid_banner_bgimage_attachment', '');
77+
if (!empty($astroid_banner_bgimage_attachment)) {
78+
$style[] = 'background-attachment:' . $astroid_banner_bgimage_attachment;
79+
}
80+
4681
$astroid_banner_class = $params->get('astroid_banner_class', '');
4782
$astroid_banner_wrapper = $params->get('astroid_banner_wrapper', '');
4883
$astroid_banner_textcolor = $params->get('astroid_banner_textcolor', '');
4984

50-
$style = [];
85+
5186
if (!empty($astroid_banner_bgcolor)) {
5287
$style[] = 'background-color:' . $astroid_banner_bgcolor;
5388
}
5489
if (!empty($astroid_banner_bgimage)) {
5590
$style[] = 'background-image:url(' . $astroid_banner_bgimage . ')';
5691
}
5792
$style = !empty($style) ? 'style="' . implode(';', $style) . '"' : '';
58-
$styletext= [];
59-
if(!empty($astroid_banner_textcolor)){
93+
$styletext = [];
94+
if (!empty($astroid_banner_textcolor)) {
6095
$styletext[] = 'color:' . $astroid_banner_textcolor;
6196
}
6297
$styletext = !empty($styletext) ? 'style="' . implode(';', $styletext) . '"' : '';
6398
?>
64-
<div class="astroid-banner-inner<?php echo!empty($astroid_banner_class) ? ' ' . $astroid_banner_class : ''; ?>" <?php echo $style; ?>>
99+
<div class="astroid-banner-inner<?php echo !empty($astroid_banner_class) ? ' ' . $astroid_banner_class : ''; ?>" <?php echo $style; ?>>
65100
<?php
66-
if (!empty($astroid_banner_wrapper)) {
67-
echo '<div class="' . $astroid_banner_wrapper . '">';
68-
}
69-
if ($astroid_banner_title_enabled) {
70-
echo '<' . $astroid_banner_title_tag . ' class="astroid-banner-title"' . $styletext . '>' . $astroid_banner_title . '</' . $astroid_banner_title_tag . '>';
71-
if (!empty($astroid_banner_subtitle)) {
72-
echo '<span class="astroid-banner-subtitle"' . $styletext . '>' . $astroid_banner_subtitle . '</span>';
101+
if (!empty($astroid_banner_wrapper)) {
102+
echo '<div class="' . $astroid_banner_wrapper . '">';
73103
}
74-
}
75-
if (!empty($astroid_banner_wrapper)) {
76-
echo '</div>';
77-
}
78-
?>
104+
if ($astroid_banner_title_enabled) {
105+
echo '<' . $astroid_banner_title_tag . ' class="astroid-banner-title"' . $styletext . '>' . $astroid_banner_title . '</' . $astroid_banner_title_tag . '>';
106+
if (!empty($astroid_banner_subtitle)) {
107+
echo '<span class="astroid-banner-subtitle"' . $styletext . '>' . $astroid_banner_subtitle . '</span>';
108+
}
109+
}
110+
if (!empty($astroid_banner_wrapper)) {
111+
echo '</div>';
112+
}
113+
?>
79114
</div>
80-
<?php
115+
<?php
81116
}
82117
?>

astroid/astroid-framework/framework/forms/banner.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,71 @@
1919
</field>
2020
<field showon="astroid_banner_enabled:1" name="astroid_banner_bgcolor" type="color" label="TPL_ASTROID_BACKGROUND_COLOR_LABEL">
2121
</field>
22+
23+
<field type="spacer" showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:" name="astroid_banner_bgimage_spacer1" hr="true"></field>
24+
2225
<field showon="astroid_banner_enabled:1" name="astroid_banner_bgimage" type="media" label="TPL_ASTROID_BACKGROUND_IMAGE_LABEL">
2326
</field>
27+
28+
<field showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:" name="astroid_banner_bgimage_position" type="list" default="" label="Background Position">
29+
<option value="">Default</option>
30+
<option value="left top">Left Top</option>
31+
<option value="left center">Left Center</option>
32+
<option value="left bottom">Left Bottom</option>
33+
<option value="right top">Right Top</option>
34+
<option value="right center">Right Center</option>
35+
<option value="right bottom">Right Bottom</option>
36+
<option value="center top">Center Top</option>
37+
<option value="center center">Center Center</option>
38+
<option value="center bottom">Center Bottom</option>
39+
<option value="custom">Custom</option>
40+
</field>
41+
42+
<field showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:[AND]astroid_banner_bgimage_position:custom" name="astroid_banner_bgimage_position_x" type="text" label="Background Position X" default="">
43+
</field>
44+
45+
<field showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:[AND]astroid_banner_bgimage_position:custom" name="astroid_banner_bgimage_position_y" type="text" label="Background Position Y" default="">
46+
</field>
47+
48+
<field type="list" showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:" name="astroid_banner_bgimage_repeat" label="Background Repeat" default="">
49+
<option value="">Default</option>
50+
<option value="no-repeat">No Repeat</option>
51+
<option value="repeat-x">Repeat-X</option>
52+
<option value="repeat-y">Repeat-Y</option>
53+
<option value="space">Space</option>
54+
<option value="round">Round</option>
55+
</field>
56+
57+
<field type="list" name="astroid_banner_bgimage_size" label="Background Size" showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:" default="">
58+
<option value="">Default</option>
59+
<option value="cover">Cover</option>
60+
<option value="contain">Contain</option>
61+
<option value="custom">Custom</option>
62+
</field>
63+
64+
<field type="text" name="astroid_banner_bgimage_width" label="Background Width" default="" showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:[AND]astroid_banner_bgimage_size:custom">
65+
</field>
66+
67+
<field type="list" showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:" name="astroid_banner_bgimage_attachment" label="Background Attachment" default="">
68+
<option value="">Default</option>
69+
<option value="fixed">Fixed</option>
70+
<option value="scroll">Scroll</option>
71+
</field>
72+
73+
<field type="spacer" showon="astroid_banner_enabled:1[AND]astroid_banner_bgimage!:" name="astroid_banner_bgimage_spacer2" hr="true"></field>
74+
2475
<field showon="astroid_banner_title_enabled:1[AND]astroid_banner_enabled:1" name="astroid_banner_title_tag" type="headertag" default="h3" label="ASTROID_BANNER_TITLE_TAG_LABEL">
2576
</field>
77+
2678
<field showon="astroid_banner_enabled:1" name="astroid_banner_class" type="text" label="ASTROID_BANNER_CLASS_LABEL">
2779
</field>
80+
2881
<field showon="astroid_banner_enabled:1" name="astroid_banner_wrapper" type="list" default="container" label="ASTROID_BANNER_LAUOUT_LABEL">
2982
<option value="">TPL_ASTROID_DEFAULT</option>
3083
<option value="container">ASTROID_CONTAINER</option>
3184
<option value="container-fluid">ASTROID_CONTAINER_FLUID</option>
3285
</field>
86+
3387
<field showon="astroid_banner_enabled:1" name="astroid_banner_visibility" type="list" label="ASTROID_BANNER_VISIBILITY_LABEL" default="allPage">
3488
<option value="currentPage">ASTROID_BANNER_VISIBILITY_OPTIONS_CURRENT_PAGE</option>
3589
<option value="allPage">ASTROID_BANNER_VISIBILITY_OPTIONS_ALL</option>

0 commit comments

Comments
 (0)