Skip to content

Commit

Permalink
Add Element Visibility feature for element
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Feb 21, 2024
1 parent 288c4cc commit de4fc4b
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 111 deletions.
4 changes: 2 additions & 2 deletions framework/elements/banner/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
$menu = $app->getMenu();
$item = $menu->getItem($menuId);
if (empty($item)) {
return;
return '';
}

$params = $item->getParams();

$astroid_banner_visibility = $params->get('astroid_banner_visibility', "currentPage");
if ($astroid_banner_visibility == "currentPage") {
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', ''))) {
return;
return '';
}
}
$style = ['display:flex', 'align-items:center'];
Expand Down
58 changes: 32 additions & 26 deletions framework/elements/column-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,47 @@
<field type="astroidtext" class="form-control" label="ASTROID_CUSTOM_ID" description="ASTROID_CUSTOM_ID_DESC" name="customid"/>
</fieldset>
<fieldset name="design-settings" label="ASTROID_ELEMENT_HEAD_DESIGN_SEETINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field name="animation" type="astroidanimations" label="ASTROID_ANIMATION"/>
<field ngShow="[animation]!=''" name="animation_delay" class="form-control" type="astroidtext" hint="500" default="500" label="ASTROID_ANIMATION_DELAY" description="ASTROID_ANIMATION_DELAY_DESC"/>
<field ngShow="[animation]!=''" name="animation_duration" class="form-control" type="astroidtext" hint="500" default="500" label="ASTROID_ANIMATION_DURATION" description="ASTROID_ANIMATION_DURATION_DESC"/>
<field description="TPL_ASTROID_ADVANCED_POPUUP_LAYOUT_SELECT_DESC" name="background_setting" type="astroidradio" default="0" label="TPL_ASTROID_ADVANCED_POPUUP_LAYOUT_SELECT_LABEL">
<field type="astroidgroup" name="general"/>
<field type="astroidgroup" name="spacing_settings" title="ASTROID_ELEMENT_HEAD_SPACING_LABEL"/>
<field astroidgroup="general" name="astroid_element_visibility" type="astroidlist" label="ASTROID_ELEMENT_VISIBILITY_LABEL" default="allPage">
<option value="allPage">ASTROID_BANNER_VISIBILITY_OPTIONS_ALL</option>
<option value="currentPage">ASTROID_BANNER_VISIBILITY_OPTIONS_CURRENT_PAGE</option>
</field>

<field astroidgroup="general" name="animation" type="astroidanimations" label="ASTROID_ANIMATION"/>
<field astroidgroup="general" ngShow="[animation]!=''" name="animation_delay" class="form-control" type="astroidtext" hint="500" default="500" label="ASTROID_ANIMATION_DELAY" description="ASTROID_ANIMATION_DELAY_DESC"/>
<field astroidgroup="general" ngShow="[animation]!=''" name="animation_duration" class="form-control" type="astroidtext" hint="500" default="500" label="ASTROID_ANIMATION_DURATION" description="ASTROID_ANIMATION_DURATION_DESC"/>
<field astroidgroup="general" description="TPL_ASTROID_ADVANCED_POPUUP_LAYOUT_SELECT_DESC" name="background_setting" type="astroidradio" default="0" label="TPL_ASTROID_ADVANCED_POPUUP_LAYOUT_SELECT_LABEL">
<option value="0">ASTROID_NONE</option>
<option value="color">TPL_ASTROID_COLOR</option>
<option value="image">TPL_ASTROID_IMAGE</option>
<option value="video">TPL_ASTROID_VIDEO</option>
<option value="gradient">TPL_ASTROID_GRADIENT</option>
</field>

<field ngShow="[background_setting] =='color'" description="ASTROID_SELECT_BACKGROUND_COLOR_DESC" name="background_color" type="astroidcolor" label="TPL_ASTROID_BACKGROUND_COLOR_LABEL" />
<field astroidgroup="general" ngShow="[background_setting] =='color'" description="ASTROID_SELECT_BACKGROUND_COLOR_DESC" name="background_color" type="astroidcolor" label="TPL_ASTROID_BACKGROUND_COLOR_LABEL" />

<field ngShow="[background_setting] =='image'" name="img_background_color" type="astroidcolor" label="TPL_ASTROID_BACKGROUND_COLOR_LABEL"/>
<field astroidgroup="general" ngShow="[background_setting] =='image'" name="img_background_color" type="astroidcolor" label="TPL_ASTROID_BACKGROUND_COLOR_LABEL"/>

<field ngShow="[background_setting] =='image'" name="background_image" type="astroidmedia" label="TPL_ASTROID_BACKGROUND_IMAGE_LABEL"/>
<field astroidgroup="general" ngShow="[background_setting] =='image'" name="background_image" type="astroidmedia" label="TPL_ASTROID_BACKGROUND_IMAGE_LABEL"/>

<field ngShow="[background_setting] =='image'" name="background_repeat" type="astroidlist" label="TPL_ASTROID_BACKGROUND_REPEAT_LABEL" hint="TPL_ASTROID_BACKGROUND_REPEAT_LABEL">
<field astroidgroup="general" ngShow="[background_setting] =='image'" name="background_repeat" type="astroidlist" label="TPL_ASTROID_BACKGROUND_REPEAT_LABEL" hint="TPL_ASTROID_BACKGROUND_REPEAT_LABEL">
<option value="">JGLOBAL_INHERIT</option>
<option value="no-repeat">TPL_ASTROID_BACKGROUND_NO_REPEAT_LABEL</option>
<option value="repeat-x">TPL_ASTROID_BACKGROUND_REPEAT_HORIZONTALLY_LABEL</option>
<option value="repeat-y">TPL_ASTROID_BACKGROUND_REPEAT_VERTICAL_LABEL</option>
</field>
<field ngShow="[background_setting] =='image'" name="background_size" type="astroidlist" label="ASTROID_BACKGROUND_SIZE">
<field astroidgroup="general" ngShow="[background_setting] =='image'" name="background_size" type="astroidlist" label="ASTROID_BACKGROUND_SIZE">
<option value="">JGLOBAL_INHERIT</option>
<option value="cover">ASTROID_BACKGROUND_SIZE_COVER</option>
<option value="contain">ASTROID_BACKGROUND_SIZE_CONTAIN</option>
</field>
<field ngShow="[background_setting] =='image'" name="background_attchment" type="astroidlist" label="ASTROID_BACKGROUND_ATTCHMENT">
<field astroidgroup="general" ngShow="[background_setting] =='image'" name="background_attchment" type="astroidlist" label="ASTROID_BACKGROUND_ATTCHMENT">
<option value="">JGLOBAL_INHERIT</option>
<option value="scroll">ASTROID_BACKGROUND_ATTCHMENT_SCROLL</option>
<option value="fixed">ASTROID_BACKGROUND_ATTCHMENT_FIXED</option>
</field>
<field ngShow="[background_setting] =='image'" name="background_position" type="astroidlist" label="ASTROID_BACKGROUND_POSITION_LABEL">
<field astroidgroup="general" ngShow="[background_setting] =='image'" name="background_position" type="astroidlist" label="ASTROID_BACKGROUND_POSITION_LABEL">
<option value="">JGLOBAL_INHERIT</option>
<option value="left top">ASTROID_BACKGROUND_POSITION_LEFT_TOP</option>
<option value="left center">ASTROID_BACKGROUND_POSITION_LEFT_CENTER</option>
Expand All @@ -54,29 +61,28 @@
<option value="center bottom">ASTROID_BACKGROUND_POSITION_CENTER_BOTTOM</option>
</field>

<field ngShow="[background_setting] =='image'" description="TPL_ASTROID_OVERLAY_COLOR_DESC" name="background_image_overlay" type="astroidradio" default="0" label="TPL_ASTROID_OVERLAY_COLOR_LABEL">
<field astroidgroup="general" ngShow="[background_setting] =='image'" description="TPL_ASTROID_OVERLAY_COLOR_DESC" name="background_image_overlay" type="astroidradio" default="0" label="TPL_ASTROID_OVERLAY_COLOR_LABEL">
<option value="">ASTROID_NONE</option>
<option value="color">TPL_ASTROID_COLOR</option>
<option value="gradient">TPL_ASTROID_GRADIENT</option>
<option value="pattern">TPL_ASTROID_PATTERN</option>
</field>
<field ngShow="[background_setting]=='image' AND ([background_image_overlay]=='color' OR [background_image_overlay]=='pattern')" description="ASTROID_SELECT_BACKGROUND_COLOR_DESC" name="background_image_overlay_color" type="astroidcolor" label="TPL_ASTROID_BACKGROUND_COLOR_LABEL" />
<field ngShow="[background_setting]=='image' AND [background_image_overlay]=='gradient'" description="ASTROID_SELECT_BACKGROUND_COLOR_DESC" name="background_image_overlay_gradient" type="astroidgradient" label="TPL_ASTROID_BG_GREDIENT_LABEL" />
<field ngShow="[background_setting]=='image' AND [background_image_overlay]=='pattern'" name="background_image_overlay_pattern" type="astroidmedia" label="TPL_ASTROID_BACKGROUND_PATTERN_IMAGE_LABEL"/>
<field astroidgroup="general" ngShow="[background_setting]=='image' AND ([background_image_overlay]=='color' OR [background_image_overlay]=='pattern')" description="ASTROID_SELECT_BACKGROUND_COLOR_DESC" name="background_image_overlay_color" type="astroidcolor" label="TPL_ASTROID_BACKGROUND_COLOR_LABEL" />
<field astroidgroup="general" ngShow="[background_setting]=='image' AND [background_image_overlay]=='gradient'" description="ASTROID_SELECT_BACKGROUND_COLOR_DESC" name="background_image_overlay_gradient" type="astroidgradient" label="TPL_ASTROID_BG_GREDIENT_LABEL" />
<field astroidgroup="general" ngShow="[background_setting]=='image' AND [background_image_overlay]=='pattern'" name="background_image_overlay_pattern" type="astroidmedia" label="TPL_ASTROID_BACKGROUND_PATTERN_IMAGE_LABEL"/>

<field ngShow="[background_setting] =='video'" name="background_video" type="astroidmedia" media="videos" label="TPL_ASTROID_BACKGROUND_VIDEO_LABEL" description="TPL_ASTROID_BACKGROUND_VIDEO_DESC"/>
<field astroidgroup="general" ngShow="[background_setting] =='video'" name="background_video" type="astroidmedia" media="videos" label="TPL_ASTROID_BACKGROUND_VIDEO_LABEL" description="TPL_ASTROID_BACKGROUND_VIDEO_DESC"/>

<field ngShow="[background_setting] =='gradient'" description="ASTROID_SELECT_BACKGROUND_COLOR_DESC" name="background_gradient" type="astroidgradient" label="TPL_ASTROID_BG_GREDIENT_LABEL"/>


<field name="custom_colors" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_ELEMENT_CUSTOM_COLORS_LABEL" />
<field astroidgroup="general" ngShow="[background_setting] =='gradient'" description="ASTROID_SELECT_BACKGROUND_COLOR_DESC" name="background_gradient" type="astroidgradient" label="TPL_ASTROID_BG_GREDIENT_LABEL"/>

<field astroidgroup="general" name="custom_colors" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_ELEMENT_CUSTOM_COLORS_LABEL" />

<field ngShow="[custom_colors]==1" name="text_color" type="astroidcolor" label="TPL_ASTROID_TEXT_COLOR_LABEL" />
<field ngShow="[custom_colors]==1" name="link_color" type="astroidcolor" label="TPL_ASTROID_LINK_COLOR_LABEL" />
<field ngShow="[custom_colors]==1" name="link_hover_color" type="astroidcolor" label="TPL_ASTROID_LINK_HOVER_COLOR_LABEL" />
<field name="spacing_settings" type="astroidheading" title="ASTROID_ELEMENT_HEAD_SPACING_LABEL" />
<field name="margin" type="astroidspacing" label="Margin" />
<field name="padding" type="astroidspacing" label="Padding" />
<field astroidgroup="general" ngShow="[custom_colors]==1" name="text_color" type="astroidcolor" label="TPL_ASTROID_TEXT_COLOR_LABEL" />
<field astroidgroup="general" ngShow="[custom_colors]==1" name="link_color" type="astroidcolor" label="TPL_ASTROID_LINK_COLOR_LABEL" />
<field astroidgroup="general" ngShow="[custom_colors]==1" name="link_hover_color" type="astroidcolor" label="TPL_ASTROID_LINK_HOVER_COLOR_LABEL" />

<field astroidgroup="spacing_settings" name="margin" type="astroidspacing" label="Margin" />
<field astroidgroup="spacing_settings" name="padding" type="astroidspacing" label="Padding" />
</fieldset>
<fieldset name="responsive-settings" label="ASTROID_ELEMENT_HEAD_RESPONSIVE_SETTINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field name="device_settings" type="astroidheading" title="ASTROID_ELEMENT_HEAD_DEVICE_VISIBILITY_LABEL" />
Expand Down
Loading

0 comments on commit de4fc4b

Please sign in to comment.