Skip to content

Instantly share code, notes, and snippets.

@hiteshaggarwal
Last active February 22, 2021 14:07
Show Gist options
  • Save hiteshaggarwal/76d4f467dfd8ba002069989c4ab5ea09 to your computer and use it in GitHub Desktop.
Save hiteshaggarwal/76d4f467dfd8ba002069989c4ab5ea09 to your computer and use it in GitHub Desktop.
<?php
$params = Astroid\Framework::getTemplate()->getParams();
$template_layout = $params->get('template_layout', 'wide');
if ($template_layout != 'boxed') return false;
$layout_background_image = $params->get('layout_background_image', '');
if (!empty($layout_background_image)) {
$style = new Astroid\Helper\Style('body');
$style->addCss('background-image', 'url(' . \JURI::root() . Astroid\Helper\Media::getPath() . '/' . $layout_background_image . ')');
$style->addCss('background-repeat', $params->get('layout_background_repeat', 'inherit'));
$style->addCss('background-size', $params->get('layout_background_size', 'inherit'));
$style->addCss('background-position', $params->get('layout_background_position', 'inherit'));
$style->addCss('background-attachment', $params->get('layout_background_attachment', 'inherit'));
$style->render();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment