Skip to content

Commit

Permalink
Add Astroid Layout Module
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Dec 9, 2024
1 parent 186a5d1 commit 1729810
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MOD_ASTROID_LAYOUT="Astroid Layout"
MOD_ASTROID_LAYOUT_XML_DESCRIPTION="This module displays the Astroid Layout on the Frontend."
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MOD_ASTROID_LAYOUT="Astroid Layout"
MOD_ASTROID_LAYOUT_XML_DESCRIPTION="This module displays the astroid layout on the Frontend."
14 changes: 14 additions & 0 deletions modules/mod_astroid_layout/mod_astroid_layout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/**
* @package Astroid Framework
* @author Astroid Framework Team https://astroidframe.work
* @copyright Copyright (C) 2023 AstroidFrame.work.
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/

defined('_JEXEC') or die;
defined('_ASTROID') or die('Please install and activate <a href="https://astroidframe.work/" target="_blank">Astroid Framework</a> in order to use this module.');
use Joomla\CMS\Helper\ModuleHelper;
$class_sfx = htmlspecialchars($params->get('class_sfx', ''), ENT_COMPAT, 'UTF-8');
require ModuleHelper::getLayoutPath('mod_astroid_layout', $params->get('layout', 'default'));
30 changes: 30 additions & 0 deletions modules/mod_astroid_layout/mod_astroid_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="module" client="site" method="upgrade">
<name>mod_astroid_layout</name>
<author>Astroid Framework</author>
<creationDate>December 2024</creationDate>
<copyright>(C) 2024 Astroid Framework</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>astroidframe.work</authorUrl>
<version>3.1.8</version>
<description>MOD_ASTROID_LAYOUT_XML_DESCRIPTION</description>
<files>
<filename module="mod_astroid_layout">mod_astroid_layout.php</filename>
<folder>tmpl</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/mod_astroid_layout.ini</language>
<language tag="en-GB">language/en-GB/mod_astroid_layout.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic" addfieldpath="/libraries/astroid/framework/fields">
<field type="astroidlayoutmodule" name="layout" data-fieldset="astroid_layout" />
</fieldset>
</fields>
</config>
<updateservers>
<server type="extension" priority="1" name="Astroid Framework">https://raw.githubusercontent.com/templaza/astroid-framework/master/astroid_framework.xml</server>
</updateservers>
</extension>
26 changes: 26 additions & 0 deletions modules/mod_astroid_layout/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* @package Astroid Framework
* @author Astroid Framework Team https://astroidframe.work
* @copyright Copyright (C) 2023 AstroidFrame.work.
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/

defined('_JEXEC') or die;
use Astroid\Element\Layout;
use Astroid\Element\Section;
$layout = Layout::loadModuleLayout($module->id);
$devices = isset($layout['devices']) && $layout['devices'] ? $layout['devices'] : [
[
'code'=> 'lg',
'icon'=> 'fa-solid fa-computer',
'title'=> 'title'
]
];
$content = '';
foreach ($layout['sections'] as $section) {
$section = new Section($section, $devices);
$content .= $section->render();
}
echo $content;

0 comments on commit 1729810

Please sign in to comment.