first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,58 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Helper\ModuleHelper;
$app = Factory::getApplication();
$form = $displayData->getForm();
$input = $app->getInput();
$fields = $displayData->get('fields') ?: [
['parent', 'parent_id'],
['published', 'state', 'enabled'],
['category', 'catid'],
'featured',
'sticky',
'access',
'language',
'tags',
'note',
'version_note',
];
$hiddenFields = $displayData->get('hidden_fields') ?: [];
if (!ModuleHelper::isAdminMultilang()) {
$hiddenFields[] = 'language';
$form->setFieldAttribute('language', 'default', '*');
}
$html = [];
$html[] = '<fieldset class="form-vertical">';
foreach ($fields as $field) {
foreach ((array) $field as $f) {
if ($form->getField($f)) {
if (in_array($f, $hiddenFields)) {
$form->setFieldAttribute($f, 'type', 'hidden');
}
$html[] = $form->renderField($f);
break;
}
}
}
$html[] = '</fieldset>';
echo implode('', $html);

View File

@ -0,0 +1,38 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
$form = $displayData->getForm();
$options = [
'formControl' => $form->getFormControl(),
'hidden' => (int) ($form->getValue('language', null, '*') === '*'),
];
// Load JavaScript message titles
Text::script('ERROR');
Text::script('WARNING');
Text::script('NOTICE');
Text::script('MESSAGE');
Text::script('JGLOBAL_ASSOC_NOT_POSSIBLE');
Text::script('JGLOBAL_ASSOCIATIONS_RESET_WARNING');
/** @var \Joomla\CMS\Document\HtmlDocument $doc */
$doc = Factory::getApplication()->getDocument();
$wa = $doc->getWebAssetManager();
$wa->getRegistry()->addExtensionRegistryFile('com_associations');
$wa->useScript('com_associations.associations-edit');
$doc->addScriptOptions('system.associations.edit', $options);
// JLayout for standard handling of associations fields in the administrator items edit screens.
echo $form->renderFieldset('item_associations');

View File

@ -0,0 +1,56 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
$app = Factory::getApplication();
$form = $displayData->getForm();
$name = $displayData->get('fieldset');
$fieldSet = $form->getFieldset($name);
if (empty($fieldSet)) {
return;
}
$ignoreFields = $displayData->get('ignore_fields') ? : [];
$extraFields = $displayData->get('extra_fields') ? : [];
if (!empty($displayData->showOptions) || $displayData->get('show_options', 1)) {
if (isset($extraFields[$name])) {
foreach ($extraFields[$name] as $f) {
if (in_array($f, $ignoreFields)) {
continue;
}
if ($form->getField($f)) {
$fieldSet[] = $form->getField($f);
}
}
}
$html = [];
foreach ($fieldSet as $field) {
$html[] = $field->renderField();
}
echo implode('', $html);
} else {
$html = [];
$html[] = '<div class="hidden">';
foreach ($fieldSet as $field) {
$html[] = $field->input;
}
$html[] = '</div>';
echo implode('', $html);
}

View File

@ -0,0 +1,69 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
// JLayout for standard handling of the edit modules:
$moduleHtml = &$displayData['moduleHtml'];
$mod = $displayData['module'];
$position = $displayData['position'];
$menusEditing = $displayData['menusediting'];
$parameters = ComponentHelper::getParams('com_modules');
$redirectUri = '&return=' . urlencode(base64_encode(Uri::getInstance()->toString()));
$target = '_blank';
$itemid = Factory::getApplication()->getInput()->get('Itemid', '0', 'int');
$editUrl = Uri::base() . 'administrator/index.php?option=com_modules&task=module.edit&id=' . (int) $mod->id;
// If Module editing site
if ($parameters->get('redirect_edit', 'site') === 'site') {
$editUrl = Uri::base() . 'index.php?option=com_config&view=modules&id=' . (int) $mod->id . '&Itemid=' . $itemid . $redirectUri;
$target = '_self';
}
// Add link for editing the module
$count = 0;
$moduleHtml = preg_replace(
// Find first tag of module
'/^(\s*<(?:div|span|nav|ul|ol|h\d|section|aside|address|article|form) [^>]*>)/',
// Create and add the edit link and tooltip
'\\1 <a class="btn btn-link jmodedit" href="' . $editUrl . '" target="' . $target . '" aria-describedby="tip-' . (int) $mod->id . '">
<span class="icon-edit" aria-hidden="true"></span><span class="visually-hidden">' . Text::_('JGLOBAL_EDIT') . '</span></a>
<div role="tooltip" id="tip-' . (int) $mod->id . '">' . Text::_('JLIB_HTML_EDIT_MODULE') . '<br>' . htmlspecialchars($mod->title, ENT_COMPAT, 'UTF-8') . '<br>' . sprintf(Text::_('JLIB_HTML_EDIT_MODULE_IN_POSITION'), htmlspecialchars($position, ENT_COMPAT, 'UTF-8')) . '</div>',
$moduleHtml,
1,
$count
);
// If menu editing is enabled and allowed and it's a menu module add link for editing
if ($menusEditing && $mod->module === 'mod_menu') {
// find the menu item id
$regex = '/\bitem-(\d+)\b/';
preg_match_all($regex, $moduleHtml, $menuItemids);
if ($menuItemids) {
foreach ($menuItemids[1] as $menuItemid) {
$menuitemEditUrl = Uri::base() . 'administrator/index.php?option=com_menus&view=item&client_id=0&layout=edit&id=' . (int) $menuItemid;
$moduleHtml = preg_replace(
// Find the link
'/(<li.*?\bitem-' . $menuItemid . '.*?>)/',
// Create and add the edit link
'\\1 <a class="jmenuedit small" href="' . $menuitemEditUrl . '" target="' . $target . '" title="' . Text::_('JLIB_HTML_EDIT_MENU_ITEM') . ' ' . sprintf(Text::_('JLIB_HTML_EDIT_MENU_ITEM_ID'), (int) $menuItemid) . '">
<span class="icon-edit" aria-hidden="true"></span></a>',
$moduleHtml
);
}
}
}

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;
$app = Factory::getApplication();
$form = $displayData->getForm();
$input = $app->getInput();
$component = $input->getCmd('option', 'com_content');
if ($component === 'com_categories') {
$extension = $input->getCmd('extension', 'com_content');
$parts = explode('.', $extension);
$component = $parts[0];
}
$saveHistory = ComponentHelper::getParams($component)->get('save_history', 0);
$fields = $displayData->get('fields') ?: [
'transition',
['parent', 'parent_id'],
['published', 'state', 'enabled'],
['category', 'catid'],
'featured',
'sticky',
'access',
'language',
'tags',
'note',
'version_note',
];
$hiddenFields = $displayData->get('hidden_fields') ?: [];
if (!$saveHistory) {
$hiddenFields[] = 'version_note';
}
if (!Multilanguage::isEnabled()) {
$hiddenFields[] = 'language';
$form->setFieldAttribute('language', 'default', '*');
}
$html = [];
$html[] = '<fieldset class="form-vertical">';
$html[] = '<legend class="visually-hidden">' . Text::_('JGLOBAL_FIELDSET_GLOBAL') . '</legend>';
foreach ($fields as $field) {
foreach ((array) $field as $f) {
if ($form->getField($f)) {
if (in_array($f, $hiddenFields)) {
$form->setFieldAttribute($f, 'type', 'hidden');
}
$html[] = $form->renderField($f);
break;
}
}
}
$html[] = '</fieldset>';
echo implode('', $html);

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
$form = $displayData->getForm();
// JLayout for standard handling of metadata fields in the administrator content edit screens.
$fieldSets = $form->getFieldsets('metadata');
?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
<div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo $this->escape(Text::_($fieldSet->description)); ?>
</div>
<?php endif; ?>
<?php
// Include the real fields in this panel.
if ($name === 'jmetadata') {
echo $form->renderField('metadesc');
echo $form->renderField('metakey');
}
foreach ($form->getFieldset($name) as $field) {
if ($field->name !== 'jform[metadata][tags][]') {
echo $field->renderField();
}
} ?>
<?php endforeach; ?>

View File

@ -0,0 +1,188 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
$app = Factory::getApplication();
$form = $displayData->getForm();
$fieldSets = $form->getFieldsets();
$helper = $displayData->get('useCoreUI', false) ? 'uitab' : 'bootstrap';
if (empty($fieldSets)) {
return;
}
$ignoreFieldsets = $displayData->get('ignore_fieldsets') ?: [];
$outputFieldsets = $displayData->get('output_fieldsets') ?: [];
$ignoreFieldsetFields = $displayData->get('ignore_fieldset_fields') ?: [];
$ignoreFields = $displayData->get('ignore_fields') ?: [];
$extraFields = $displayData->get('extra_fields') ?: [];
$tabName = $displayData->get('tab_name') ?: 'myTab';
// These are required to preserve data on save when fields are not displayed.
$hiddenFieldsets = $displayData->get('hiddenFieldsets') ?: [];
// These are required to configure showing and hiding fields in the editor.
$configFieldsets = $displayData->get('configFieldsets') ?: [];
// Handle the hidden fieldsets when show_options is set false
if (!$displayData->get('show_options', 1)) {
// The HTML buffer
$html = [];
// Loop over the fieldsets
foreach ($fieldSets as $name => $fieldSet) {
// Check if the fieldset should be ignored
if (in_array($name, $ignoreFieldsets, true)) {
continue;
}
// If it is a hidden fieldset, render the inputs
if (in_array($name, $hiddenFieldsets)) {
// Loop over the fields
foreach ($form->getFieldset($name) as $field) {
// Add only the input on the buffer
$html[] = $field->input;
}
// Make sure the fieldset is not rendered twice
$ignoreFieldsets[] = $name;
}
// Check if it is the correct fieldset to ignore
if (strpos($name, 'basic') === 0) {
// Ignore only the fieldsets which are defined by the options not the custom fields ones
$ignoreFieldsets[] = $name;
}
}
// Echo the hidden fieldsets
echo implode('', $html);
}
$opentab = false;
$xml = $form->getXml();
// Loop again over the fieldsets
foreach ($fieldSets as $name => $fieldSet) {
// Ensure any fieldsets we don't want to show are skipped (including repeating formfield fieldsets)
if (
(isset($fieldSet->repeat) && $fieldSet->repeat === true)
|| in_array($name, $ignoreFieldsets)
|| (!empty($configFieldsets) && in_array($name, $configFieldsets, true))
|| (!empty($hiddenFieldsets) && in_array($name, $hiddenFieldsets, true))
) {
continue;
}
// Determine the label
if (!empty($fieldSet->label)) {
$label = Text::_($fieldSet->label);
} else {
$label = strtoupper('JGLOBAL_FIELDSET_' . $name);
if (Text::_($label) === $label) {
$label = strtoupper($app->getInput()->get('option') . '_' . $name . '_FIELDSET_LABEL');
}
$label = Text::_($label);
}
$hasChildren = $xml->xpath('//fieldset[@name="' . $name . '"]//fieldset[not(ancestor::field/form/*)]');
$hasParent = $xml->xpath('//fieldset//fieldset[@name="' . $name . '"]');
$isGrandchild = $xml->xpath('//fieldset//fieldset//fieldset[@name="' . $name . '"]');
if (!$isGrandchild && $hasParent) {
echo '<fieldset id="fieldset-' . $name . '" class="options-form ' . (!empty($fieldSet->class) ? $fieldSet->class : '') . '">';
echo '<legend>' . $label . '</legend>';
// Include the description when available
if (!empty($fieldSet->description)) {
echo '<div class="alert alert-info">';
echo '<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden">' . Text::_('INFO') . '</span> ';
echo Text::_($fieldSet->description);
echo '</div>';
}
echo '<div class="form-grid">';
} elseif (!$hasParent) {
// Tabs
if ($opentab) {
if ($opentab > 1) {
echo '</div>';
echo '</fieldset>';
}
// End previous tab
echo HTMLHelper::_($helper . '.endTab');
}
// Start the tab
echo HTMLHelper::_($helper . '.addTab', $tabName, 'attrib-' . $name, $label);
$opentab = 1;
// Directly add a fieldset if we have no children
if (!$hasChildren) {
echo '<fieldset id="fieldset-' . $name . '" class="options-form ' . (!empty($fieldSet->class) ? $fieldSet->class : '') . '">';
echo '<legend>' . $label . '</legend>';
// Include the description when available
if (!empty($fieldSet->description)) {
echo '<div class="alert alert-info">';
echo '<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden">' . Text::_('INFO') . '</span> ';
echo Text::_($fieldSet->description);
echo '</div>';
}
echo '<div class="form-grid">';
$opentab = 2;
} elseif (!empty($fieldSet->description)) {
// Include the description when available
echo '<div class="alert alert-info alert-parent">';
echo '<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden">' . Text::_('INFO') . '</span> ';
echo Text::_($fieldSet->description);
echo '</div>';
}
}
// We're on the deepest level => output fields
if (!$hasChildren) {
// The name of the fieldset to render
$displayData->fieldset = $name;
// Force to show the options
$displayData->showOptions = true;
// Render the fieldset
echo LayoutHelper::render('joomla.edit.fieldset', $displayData);
}
// Close open fieldset
if (!$isGrandchild && $hasParent) {
echo '</div>';
echo '</fieldset>';
}
}
if ($opentab) {
if ($opentab > 1) {
echo '</div>';
echo '</fieldset>';
}
// End previous tab
echo HTMLHelper::_($helper . '.endTab');
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: [
'publish_up',
'publish_down',
'featured_up',
'featured_down',
['created', 'created_time'],
['created_by', 'created_user_id'],
'created_by_alias',
['modified', 'modified_time'],
['modified_by', 'modified_user_id'],
'version',
'hits',
'id'
];
$hiddenFields = $displayData->get('hidden_fields') ?: [];
foreach ($fields as $field) {
foreach ((array) $field as $f) {
if ($form->getField($f)) {
if (in_array($f, $hiddenFields)) {
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}

View File

@ -0,0 +1,25 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$form = $displayData->getForm();
$title = $form->getField('title') ? 'title' : ($form->getField('name') ? 'name' : '');
?>
<div class="row title-alias form-vertical mb-3">
<div class="col-12 col-md-6">
<?php echo $title ? $form->renderField($title) : ''; ?>
</div>
<div class="col-12 col-md-6">
<?php echo $form->renderField('alias'); ?>
</div>
</div>