Skip to content

Commit e6cba44

Browse files
committed
Add isset checks for mobile margin state variables
1 parent 03165f4 commit e6cba44

File tree

3 files changed

+40
-25
lines changed

3 files changed

+40
-25
lines changed

views/templates/hook/prettyblocks/prettyblock_category_highlight.tpl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@
7171
{/if}
7272
</div>
7373
</div>
74-
{if $state.margin_left_mobile || $state.margin_right_mobile || $state.margin_top_mobile || $state.margin_bottom_mobile}
74+
{if (isset($state.margin_left_mobile) && $state.margin_left_mobile) ||
75+
(isset($state.margin_right_mobile) && $state.margin_right_mobile) ||
76+
(isset($state.margin_top_mobile) && $state.margin_top_mobile) ||
77+
(isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile)}
7578
<style>
7679
@media (max-width: 767px) {
7780
#block-{$block.id_prettyblocks}-{$key} .position-relative {
78-
{if $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall'};{/if}
79-
{if $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall'};{/if}
80-
{if $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall'};{/if}
81-
{if $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall'};{/if}
81+
{if isset($state.margin_left_mobile) && $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall'};{/if}
82+
{if isset($state.margin_right_mobile) && $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall'};{/if}
83+
{if isset($state.margin_top_mobile) && $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall'};{/if}
84+
{if isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall'};{/if}
8285
}
8386
}
8487
</style>

views/templates/hook/prettyblocks/prettyblock_cover.tpl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,17 @@
6262
{/if}
6363
</div>
6464
</div>
65-
{if $state.margin_left_mobile || $state.margin_right_mobile || $state.margin_top_mobile || $state.margin_bottom_mobile}
65+
{if (isset($state.margin_left_mobile) && $state.margin_left_mobile) ||
66+
(isset($state.margin_right_mobile) && $state.margin_right_mobile) ||
67+
(isset($state.margin_top_mobile) && $state.margin_top_mobile) ||
68+
(isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile)}
6669
<style>
6770
@media (max-width: 767px) {
6871
#block-{$block.id_prettyblocks}-{$key} {
69-
{if $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall'};{/if}
70-
{if $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall'};{/if}
71-
{if $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall'};{/if}
72-
{if $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall'};{/if}
72+
{if isset($state.margin_left_mobile) && $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall'};{/if}
73+
{if isset($state.margin_right_mobile) && $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall'};{/if}
74+
{if isset($state.margin_top_mobile) && $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall'};{/if}
75+
{if isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall'};{/if}
7376
}
7477
}
7578
</style>
@@ -113,14 +116,17 @@
113116
{/if}
114117
</div>
115118
</div>
116-
{if $state.margin_left_mobile || $state.margin_right_mobile || $state.margin_top_mobile || $state.margin_bottom_mobile}
119+
{if (isset($state.margin_left_mobile) && $state.margin_left_mobile) ||
120+
(isset($state.margin_right_mobile) && $state.margin_right_mobile) ||
121+
(isset($state.margin_top_mobile) && $state.margin_top_mobile) ||
122+
(isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile)}
117123
<style>
118124
@media (max-width: 767px) {
119125
#block-{$block.id_prettyblocks}-{$key} {
120-
{if $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall'};{/if}
121-
{if $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall'};{/if}
122-
{if $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall'};{/if}
123-
{if $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall'};{/if}
126+
{if isset($state.margin_left_mobile) && $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall'};{/if}
127+
{if isset($state.margin_right_mobile) && $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall'};{/if}
128+
{if isset($state.margin_top_mobile) && $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall'};{/if}
129+
{if isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall'};{/if}
124130
}
125131
}
126132
</style>

views/templates/hook/prettyblocks/prettyblock_img.tpl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,17 @@
6565
</a>
6666
{/if}
6767
</div>
68-
{if $state.margin_left_mobile || $state.margin_right_mobile || $state.margin_top_mobile || $state.margin_bottom_mobile}
68+
{if (isset($state.margin_left_mobile) && $state.margin_left_mobile) ||
69+
(isset($state.margin_right_mobile) && $state.margin_right_mobile) ||
70+
(isset($state.margin_top_mobile) && $state.margin_top_mobile) ||
71+
(isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile)}
6972
<style>
7073
@media (max-width: 767px) {
7174
#block-{$block.id_prettyblocks}-{$key} {
72-
{if $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall':'UTF-8'};{/if}
73-
{if $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall':'UTF-8'};{/if}
74-
{if $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall':'UTF-8'};{/if}
75-
{if $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall':'UTF-8'};{/if}
75+
{if isset($state.margin_left_mobile) && $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall':'UTF-8'};{/if}
76+
{if isset($state.margin_right_mobile) && $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall':'UTF-8'};{/if}
77+
{if isset($state.margin_top_mobile) && $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall':'UTF-8'};{/if}
78+
{if isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall':'UTF-8'};{/if}
7679
}
7780
}
7881
</style>
@@ -121,14 +124,17 @@
121124
</a>
122125
{/if}
123126
</div>
124-
{if $state.margin_left_mobile || $state.margin_right_mobile || $state.margin_top_mobile || $state.margin_bottom_mobile}
127+
{if (isset($state.margin_left_mobile) && $state.margin_left_mobile) ||
128+
(isset($state.margin_right_mobile) && $state.margin_right_mobile) ||
129+
(isset($state.margin_top_mobile) && $state.margin_top_mobile) ||
130+
(isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile)}
125131
<style>
126132
@media (max-width: 767px) {
127133
#block-{$block.id_prettyblocks}-{$key} {
128-
{if $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall':'UTF-8'};{/if}
129-
{if $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall':'UTF-8'};{/if}
130-
{if $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall':'UTF-8'};{/if}
131-
{if $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall':'UTF-8'};{/if}
134+
{if isset($state.margin_left_mobile) && $state.margin_left_mobile}margin-left:{$state.margin_left_mobile|escape:'htmlall':'UTF-8'};{/if}
135+
{if isset($state.margin_right_mobile) && $state.margin_right_mobile}margin-right:{$state.margin_right_mobile|escape:'htmlall':'UTF-8'};{/if}
136+
{if isset($state.margin_top_mobile) && $state.margin_top_mobile}margin-top:{$state.margin_top_mobile|escape:'htmlall':'UTF-8'};{/if}
137+
{if isset($state.margin_bottom_mobile) && $state.margin_bottom_mobile}margin-bottom:{$state.margin_bottom_mobile|escape:'htmlall':'UTF-8'};{/if}
132138
}
133139
}
134140
</style>

0 commit comments

Comments
 (0)