-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add module style option for Layout Builder
- Loading branch information
Showing
11 changed files
with
151 additions
and
92 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?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('JPATH_BASE') or die; | ||
use Joomla\CMS\Factory; | ||
use Joomla\CMS\Form\FormHelper; | ||
use Joomla\CMS\Form\Field\ListField; | ||
use Joomla\Component\Modules\Administrator\Helper\ModulesHelper; | ||
use Joomla\CMS\Language\Text; | ||
FormHelper::loadFieldClass('list'); | ||
|
||
/** | ||
* Modules Position field. | ||
* | ||
* @since 3.4.2 | ||
*/ | ||
class JFormFieldAstroidModulesStyle extends ListField | ||
{ | ||
|
||
/** | ||
* The form field type. | ||
* | ||
* @var string | ||
* @since 3.4.2 | ||
*/ | ||
protected $type = 'AstroidModulesStyle'; | ||
protected $ordering; | ||
protected function getInput() | ||
{ | ||
// Get the field options. | ||
$options = Astroid\Helper::getModuleStyles(); | ||
if ($this->value) { | ||
$value = $this->value; | ||
} else { | ||
$value = 'astroidxhtml'; | ||
} | ||
|
||
$json = [ | ||
'id' => $this->id, | ||
'name' => $this->name, | ||
'value' => $value, | ||
'options' => $options, | ||
'type' => strtolower($this->type), | ||
]; | ||
return json_encode($json); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/** | ||
* @package Astroid Framework | ||
* @author Astroid Framework 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 Joomla\Utilities\ArrayHelper; | ||
|
||
$module = $displayData['module']; | ||
$params = $displayData['params']; | ||
$attribs = $displayData['attribs']; | ||
|
||
if ($module->content === null || $module->content === '') { | ||
return; | ||
} | ||
|
||
$moduleTag = $params->get('module_tag', 'div'); | ||
$moduleAttribs = []; | ||
$moduleAttribs['class'] = $module->position . ' moduletable ' . htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_QUOTES, 'UTF-8'); | ||
$headerTag = htmlspecialchars($params->get('header_tag', 'h3'), ENT_QUOTES, 'UTF-8'); | ||
$headerClass = htmlspecialchars($params->get('header_class', ''), ENT_QUOTES, 'UTF-8'); | ||
$headerAttribs = []; | ||
|
||
// Only output a header class if one is set | ||
if ($headerClass !== '') { | ||
$headerAttribs['class'] = $headerClass; | ||
} | ||
|
||
// Only add aria if the moduleTag is not a div | ||
if ($moduleTag !== 'div') { | ||
if ($module->showtitle) : | ||
$moduleAttribs['aria-labelledby'] = 'mod-' . $module->id; | ||
$headerAttribs['id'] = 'mod-' . $module->id; | ||
else : | ||
$moduleAttribs['aria-label'] = $module->title; | ||
endif; | ||
} | ||
|
||
$header = '<' . $headerTag . ' ' . ArrayHelper::toString($headerAttribs) . '>' . $module->title . '</' . $headerTag . '>'; | ||
?> | ||
<<?php echo $moduleTag; ?> <?php echo ArrayHelper::toString($moduleAttribs); ?>> | ||
<?php if ($module->showtitle) : ?> | ||
<?php echo $header; ?> | ||
<?php endif; ?> | ||
<?php echo $module->content; ?> | ||
</<?php echo $moduleTag; ?>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters