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

61
layouts/chromes/html5.php Normal file
View File

@ -0,0 +1,61 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* html5 (chosen html5 tag and font header tags)
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
$module = $displayData['module'];
$params = $displayData['params'];
$attribs = $displayData['attribs'];
if ((string) $module->content === '') {
return;
}
$moduleTag = htmlspecialchars($params->get('module_tag', 'div'), ENT_QUOTES, 'UTF-8');
$moduleAttribs = [];
$moduleAttribs['class'] = 'moduletable ' . htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_QUOTES, 'UTF-8');
$bootstrapSize = (int) $params->get('bootstrap_size', 0);
$moduleAttribs['class'] .= $bootstrapSize !== 0 ? ' col-md-' . $bootstrapSize : '';
$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;
}
// Add class from attributes if any
if (!empty($attribs['class'])) {
$moduleAttribs['class'] .= ' ' . htmlspecialchars($attribs['class'], ENT_QUOTES, 'UTF-8');
}
// 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 ((bool) $module->showtitle) : ?>
<?php echo $header; ?>
<?php endif; ?>
<?php echo $module->content; ?>
</<?php echo $moduleTag; ?>>

13
layouts/chromes/none.php Normal file
View File

@ -0,0 +1,13 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
echo $displayData['module']->content;

View File

@ -0,0 +1,35 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2019 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;
Factory::getApplication()->getDocument()
->getWebAssetManager()
->registerAndUseStyle('layouts.chromes.outline', 'layouts/chromes/outline.css');
$module = $displayData['module'];
?>
<div class="mod-preview">
<div class="mod-preview-info">
<div class="mod-preview-position">
<?php echo Text::sprintf('JGLOBAL_PREVIEW_POSITION', $module->position); ?>
</div>
<div class="mod-preview-style">
<?php echo Text::sprintf('JGLOBAL_PREVIEW_STYLE', $module->style); ?>
</div>
</div>
<div class="mod-preview-wrapper">
<?php echo $module->content; ?>
</div>
</div>

32
layouts/chromes/table.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* Module chrome that wraps the module in a table
*/
defined('_JEXEC') or die;
$module = $displayData['module'];
$params = $displayData['params'];
?>
<table
class="moduletable <?php echo htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_COMPAT, 'UTF-8'); ?>">
<?php if ((bool) $module->showtitle) : ?>
<tr>
<th>
<?php echo $module->title; ?>
</th>
</tr>
<?php endif; ?>
<tr>
<td>
<?php echo $module->content; ?>
</td>
</tr>
</table>

1
layouts/index.html Normal file
View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,50 @@
<?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
*/
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
extract($displayData, EXTR_OVERWRITE);
/**
* Layout variables
* -----------------
* @var string $icon
* @var string $title
* @var string $value
* @var string $task
* @var array $options
*/
Factory::getDocument()->getWebAssetManager()->useScript('list-view');
$disabled = !empty($options['disabled']);
$taskPrefix = $options['task_prefix'];
$checkboxName = $options['checkbox_name'];
$id = $options['id'];
$tipTitle = $options['tip_title'];
?>
<button type="button"
class="js-grid-item-action tbody-icon data-state-<?php echo $this->escape($value ?? ''); ?>"
aria-labelledby="<?php echo $id; ?>"
<?php echo $disabled ? 'disabled' : ''; ?>
data-item-id="<?php echo $checkboxName . $this->escape($row ?? ''); ?>"
data-item-task="<?php echo $this->escape(isset($task) ? $taskPrefix . $task : ''); ?>"
>
<span class="<?php echo $this->escape($icon ?? ''); ?>" aria-hidden="true"></span>
</button>
<div id="<?php echo $id; ?>" role="tooltip">
<?php echo HTMLHelper::_('tooltipText', $tipTitle ?: $title, $title, 0, false); ?>
</div>

View File

@ -0,0 +1,17 @@
<?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\Layout\LayoutHelper;
$displayData['html'] = false;
echo LayoutHelper::render('joomla.icon.iconclass', $displayData);

View File

@ -0,0 +1,77 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
extract($displayData, EXTR_OVERWRITE);
/**
* Layout variables
* -----------------
* @var string $icon
* @var string $title
* @var string $value
* @var string $task
* @var array $options
*/
$disabled = empty($options['transitions']) || !empty($options['disabled']);
$id = $options['id'];
$tipTitle = $options['tip_title'];
$tipContent = $options['tip_content'];
$checkboxName = $options['checkbox_name'];
$task = $options['task'];
?>
<button type="button" class="tbody-icon data-state-<?php echo $this->escape($value ?? ''); ?>"
aria-labelledby="<?php echo $id; ?>"
<?php echo $disabled ? 'disabled' : ''; ?>
<?php if (!$disabled) : ?>
onclick="Joomla.toggleAllNextElements(this, 'd-none')"
<?php endif; ?>
>
<span class="<?php echo $this->escape($icon ?? ''); ?>" aria-hidden="true"></span>
</button>
<div id="<?php echo $id; ?>" role="tooltip">
<?php echo HTMLHelper::_('tooltipText', $tipTitle ?: $title, $tipContent, 0, false); ?>
</div>
<?php if (!$disabled) : ?>
<div class="d-none">
<span class="visually-hidden">
<label for="transition-select_<?php echo (int) $row ?? ''; ?>">
<?php echo Text::_('JWORKFLOW_EXECUTE_TRANSITION'); ?>
</label>
</span>
<?php
$default = [
HTMLHelper::_('select.option', '', $this->escape($options['title'])),
HTMLHelper::_('select.option', '-1', '--------', ['disable' => true]),
HTMLHelper::_('select.option', '<OPTGROUP>', Text::_('COM_CONTENT_RUN_TRANSITION')),
];
$transitions = array_merge($default, $options['transitions'], [HTMLHelper::_('select.option', '</OPTGROUP>')]);
$attribs = [
'id' => 'transition-select_' . (int) $row ?? '',
'list.attr' => [
'class' => 'form-select form-select-sm w-auto',
'onchange' => "this.form.transition_id.value=this.value;Joomla.listItemTask('" . $checkboxName . $this->escape($row ?? '') . "', '" . $task . "')"]
];
echo HTMLHelper::_('select.genericlist', $transitions, '', $attribs);
?>
</div>
<?php endif; ?>

View File

@ -0,0 +1,29 @@
<?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;
$items = $displayData;
if (!empty($items)) : ?>
<ul class="item-associations">
<?php foreach ($items as $id => $item) : ?>
<?php if (is_array($item) && isset($item['link'])) : ?>
<li>
<?php echo $item['link']; ?>
</li>
<?php elseif (isset($item->link)) : ?>
<li>
<?php echo $item->link; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>

View File

@ -0,0 +1,51 @@
<?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;
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Site\Helper\RouteHelper;
// Create a shortcut for params.
$params = $displayData->params;
$canEdit = $displayData->params->get('access-edit');
$currentDate = Factory::getDate()->format('Y-m-d H:i:s');
$link = RouteHelper::getArticleRoute($displayData->slug, $displayData->catid, $displayData->language);
?>
<?php if ($displayData->state == 0 || $params->get('show_title') || ($params->get('show_author') && !empty($displayData->author))) : ?>
<div class="page-header">
<?php if ($params->get('show_title')) : ?>
<h2>
<?php if ($params->get('link_titles') && ($params->get('access-view') || $params->get('show_noauth', '0') == '1')) : ?>
<a href="<?php echo Route::_($link); ?>">
<?php echo $this->escape($displayData->title); ?>
</a>
<?php else : ?>
<?php echo $this->escape($displayData->title); ?>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if ($displayData->state == 0) : ?>
<span class="badge bg-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php if ($displayData->publish_up > $currentDate) : ?>
<span class="badge bg-warning"><?php echo Text::_('JNOTPUBLISHEDYET'); ?></span>
<?php endif; ?>
<?php if ($displayData->publish_down !== null && $displayData->publish_down < $currentDate) : ?>
<span class="badge bg-warning"><?php echo Text::_('JEXPIRED'); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>

View File

@ -0,0 +1,36 @@
<?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\HTML\HTMLHelper;
?>
<?php if ($displayData->params->get('show_page_heading')) : ?>
<h1>
<?php echo $displayData->escape($displayData->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($displayData->params->get('show_base_description')) : ?>
<?php // If there is a description in the menu parameters use that; ?>
<?php if ($displayData->params->get('categories_description')) : ?>
<div class="category-desc base-desc">
<?php echo HTMLHelper::_('content.prepare', $displayData->params->get('categories_description'), '', $displayData->get('extension') . '.categories'); ?>
</div>
<?php else : ?>
<?php // Otherwise get one from the database if it exists. ?>
<?php if ($displayData->parent->description) : ?>
<div class="category-desc base-desc">
<?php echo HTMLHelper::_('content.prepare', $displayData->parent->description, '', $displayData->parent->extension . '.categories'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>

View File

@ -0,0 +1,102 @@
<?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;
/**
* Note that this layout opens a div with the page class suffix. If you do not use the category children
* layout you need to close this div either by overriding this file or in your main layout.
*/
$params = $displayData->params;
$category = $displayData->get('category');
$extension = $category->extension;
$canEdit = $params->get('access-edit');
$className = substr($extension, 4);
$htag = $params->get('show_page_heading') ? 'h2' : 'h1';
$app = Factory::getApplication();
$category->text = $category->description;
$app->triggerEvent('onContentPrepare', [$extension . '.categories', &$category, &$params, 0]);
$category->description = $category->text;
$results = $app->triggerEvent('onContentAfterTitle', [$extension . '.categories', &$category, &$params, 0]);
$afterDisplayTitle = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentBeforeDisplay', [$extension . '.categories', &$category, &$params, 0]);
$beforeDisplayContent = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentAfterDisplay', [$extension . '.categories', &$category, &$params, 0]);
$afterDisplayContent = trim(implode("\n", $results));
/**
* This will work for the core components but not necessarily for other components
* that may have different pluralisation rules.
*/
if (substr($className, -1) === 's') {
$className = rtrim($className, 's');
}
$tagsData = $category->tags->itemTags;
?>
<div class="<?php echo $className . '-category' . $displayData->pageclass_sfx; ?>">
<?php if ($params->get('show_page_heading')) : ?>
<h1>
<?php echo $displayData->escape($params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($params->get('show_category_title', 1)) : ?>
<<?php echo $htag; ?>>
<?php echo HTMLHelper::_('content.prepare', $category->title, '', $extension . '.category.title'); ?>
</<?php echo $htag; ?>>
<?php endif; ?>
<?php echo $afterDisplayTitle; ?>
<?php if ($params->get('show_cat_tags', 1)) : ?>
<?php echo LayoutHelper::render('joomla.content.tags', $tagsData); ?>
<?php endif; ?>
<?php if ($beforeDisplayContent || $afterDisplayContent || $params->get('show_description', 1) || $params->def('show_description_image', 1)) : ?>
<div class="category-desc">
<?php if ($params->get('show_description_image') && $category->getParams()->get('image')) : ?>
<?php echo LayoutHelper::render(
'joomla.html.image',
[
'src' => $category->getParams()->get('image'),
'alt' => empty($category->getParams()->get('image_alt')) && empty($category->getParams()->get('image_alt_empty')) ? false : $category->getParams()->get('image_alt'),
]
); ?>
<?php endif; ?>
<?php echo $beforeDisplayContent; ?>
<?php if ($params->get('show_description') && $category->description) : ?>
<?php echo HTMLHelper::_('content.prepare', $category->description, '', $extension . '.category.description'); ?>
<?php endif; ?>
<?php echo $afterDisplayContent; ?>
</div>
<?php endif; ?>
<?php echo $displayData->loadTemplate($displayData->subtemplatename); ?>
<?php if ($displayData->maxLevel != 0 && $displayData->get('children')) : ?>
<div class="cat-children">
<?php if ($params->get('show_category_heading_title_text', 1) == 1) : ?>
<h3>
<?php echo Text::_('JGLOBAL_SUBCATEGORIES'); ?>
</h3>
<?php endif; ?>
<?php echo $displayData->loadTemplate('children'); ?>
</div>
<?php endif; ?>
</div>

View File

@ -0,0 +1,64 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2021 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\Router\Route;
$textPrefix = $displayData['textPrefix'] ?? '';
if (!$textPrefix) {
$textPrefix = strtoupper(Factory::getApplication()->getInput()->get('option'));
}
$formURL = $displayData['formURL'] ?? '';
$createURL = $displayData['createURL'] ?? '';
$helpURL = $displayData['helpURL'] ?? '';
$title = $displayData['title'] ?? Text::_($textPrefix . '_EMPTYSTATE_TITLE');
$content = $displayData['content'] ?? Text::_($textPrefix . '_EMPTYSTATE_CONTENT');
$icon = $displayData['icon'] ?? 'icon-copy article';
$append = $displayData['formAppend'] ?? '';
$btnadd = $displayData['btnadd'] ?? Text::_($textPrefix . '_EMPTYSTATE_BUTTON_ADD');
?>
<form action="<?php echo Route::_($formURL); ?>" method="post" name="adminForm" id="adminForm">
<div class="px-4 py-5 my-5 text-center">
<span class="fa-8x mb-4 <?php echo $icon; ?>" aria-hidden="true"></span>
<h1 class="display-5 fw-bold"><?php echo $title; ?></h1>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4">
<?php echo $content; ?>
</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<?php if ($createURL && Factory::getApplication()->getInput()->get('tmpl') !== 'component') : ?>
<a href="<?php echo Route::_($createURL); ?>"
id="confirmButton" class="btn btn-primary btn-lg px-4 me-sm-3 emptystate-btnadd"><?php echo $btnadd; ?></a>
<?php endif; ?>
<?php if ($helpURL) : ?>
<a href="<?php echo $helpURL; ?>" target="_blank"
class="btn btn-outline-secondary btn-lg px-4"><?php echo Text::_('JGLOBAL_LEARN_MORE'); ?></a>
<?php endif; ?>
</div>
</div>
</div>
<?php
// Allow appending any modals (Eg: Bulk Import on com_redirect).
echo $append;
?>
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<?php echo HTMLHelper::_('form.token'); ?>
</form>

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2021 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;
$icon = $displayData['icon'] ?? 'icon-copy article';
$textPrefix = $displayData['textPrefix'] ?? '';
$textSuffix = $displayData['textSuffix'] ?? '';
$title = $displayData['title'] ?? '';
$componentLangString = $textPrefix . '_EMPTYSTATE_TITLE' . $textSuffix;
$moduleLangString = $textPrefix . '_EMPTYSTATE_MODULE_TITLE' . $textSuffix;
// Did we have a definitive title provided to the view? If not, let's find one!
if (!$title) {
// Can we find a *_EMPTYSTATE_MODULE_TITLE translation, Else use the components *_EMPTYSTATE_TITLE string
$title = Factory::getApplication()->getLanguage()->hasKey($moduleLangString) ? $moduleLangString : $componentLangString;
}
?>
<div class="mb-4">
<p class="fw-bold text-center text-muted">
<span class="<?php echo $icon; ?>" aria-hidden="true"></span> <?php echo Text::_($title); ?>
</p>
</div>

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\Layout\LayoutHelper;
$params = $displayData->params;
$images = json_decode($displayData->images);
if (empty($images->image_fulltext)) {
return;
}
$imgclass = empty($images->float_fulltext) ? $params->get('float_fulltext') : $images->float_fulltext;
$layoutAttr = [
'src' => $images->image_fulltext,
'alt' => empty($images->image_fulltext_alt) && empty($images->image_fulltext_alt_empty) ? false : $images->image_fulltext_alt,
];
?>
<figure class="<?php echo $this->escape($imgclass); ?> item-image">
<?php echo LayoutHelper::render('joomla.html.image', $layoutAttr); ?>
<?php if (isset($images->image_fulltext_caption) && $images->image_fulltext_caption !== '') : ?>
<figcaption class="caption"><?php echo $this->escape($images->image_fulltext_caption); ?></figcaption>
<?php endif; ?>
</figure>

View File

@ -0,0 +1,27 @@
<?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\HTML\HTMLHelper;
$canEdit = $displayData['params']->get('access-edit');
$articleId = $displayData['item']->id;
?>
<?php if ($canEdit) : ?>
<div class="icons">
<div class="float-end">
<div>
<?php echo HTMLHelper::_('icon.edit', $displayData['item'], $displayData['params']); ?>
</div>
</div>
</div>
<?php endif; ?>

View File

@ -0,0 +1,24 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @deprecated 4.3 will be removed in 6.0
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
$params = $displayData['params'];
?>
<?php if ($params->get('show_icons')) : ?>
<span class="icon-plus icon-fw" aria-hidden="true"></span>
<?php echo Text::_('JNEW'); ?>
<?php else : ?>
<?php echo Text::_('JNEW') . '&#160;'; ?>
<?php endif; ?>

View File

@ -0,0 +1,35 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
$article = $displayData['article'];
$tooltip = $displayData['tooltip'];
$nowDate = strtotime(Factory::getDate());
$icon = $article->state ? 'edit' : 'eye-slash';
$currentDate = Factory::getDate()->format('Y-m-d H:i:s');
$isUnpublished = ($article->publish_up > $currentDate)
|| !is_null($article->publish_down) && ($article->publish_down < $currentDate);
if ($isUnpublished) {
$icon = 'eye-slash';
}
$aria_described = 'editarticle-' . (int) $article->id;
?>
<span class="icon-<?php echo $icon; ?>" aria-hidden="true"></span>
<?php echo Text::_('JGLOBAL_EDIT'); ?>
<div role="tooltip" id="<?php echo $aria_described; ?>">
<?php echo $tooltip; ?>
</div>

View File

@ -0,0 +1,32 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
if (isset($displayData['ariaDescribed'])) {
$aria_described = $displayData['ariaDescribed'];
} elseif (isset($displayData['article'])) {
$article = $displayData['article'];
$aria_described = 'editarticle-' . (int) $article->id;
} elseif (isset($displayData['contact'])) {
$contact = $displayData['contact'];
$aria_described = 'editcontact-' . (int) $contact->id;
}
$tooltip = $displayData['tooltip'];
?>
<span class="hasTooltip icon-lock" aria-hidden="true"></span>
<?php echo Text::_('JLIB_HTML_CHECKED_OUT'); ?>
<div role="tooltip" id="<?php echo $aria_described; ?>">
<?php echo $tooltip; ?>
</div>

View File

@ -0,0 +1,70 @@
<?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\Language\Text;
$blockPosition = $displayData['params']->get('info_block_position', 0);
?>
<dl class="article-info text-muted">
<?php
if (
$displayData['position'] === 'above' && ($blockPosition == 0 || $blockPosition == 2)
|| $displayData['position'] === 'below' && ($blockPosition == 1)
) : ?>
<dt class="article-info-term">
<?php if ($displayData['params']->get('info_block_show_title', 1)) : ?>
<?php echo Text::_('COM_CONTENT_ARTICLE_INFO'); ?>
<?php endif; ?>
</dt>
<?php if ($displayData['params']->get('show_author') && !empty($displayData['item']->author)) : ?>
<?php echo $this->sublayout('author', $displayData); ?>
<?php endif; ?>
<?php if ($displayData['params']->get('show_parent_category') && !empty($displayData['item']->parent_id)) : ?>
<?php echo $this->sublayout('parent_category', $displayData); ?>
<?php endif; ?>
<?php if ($displayData['params']->get('show_category')) : ?>
<?php echo $this->sublayout('category', $displayData); ?>
<?php endif; ?>
<?php if ($displayData['params']->get('show_associations')) : ?>
<?php echo $this->sublayout('associations', $displayData); ?>
<?php endif; ?>
<?php if ($displayData['params']->get('show_publish_date')) : ?>
<?php echo $this->sublayout('publish_date', $displayData); ?>
<?php endif; ?>
<?php endif; ?>
<?php
if (
$displayData['position'] === 'above' && ($blockPosition == 0)
|| $displayData['position'] === 'below' && ($blockPosition == 1 || $blockPosition == 2)
) : ?>
<?php if ($displayData['params']->get('show_create_date')) : ?>
<?php echo $this->sublayout('create_date', $displayData); ?>
<?php endif; ?>
<?php if ($displayData['params']->get('show_modify_date')) : ?>
<?php echo $this->sublayout('modify_date', $displayData); ?>
<?php endif; ?>
<?php if ($displayData['params']->get('show_hits')) : ?>
<?php echo $this->sublayout('hits', $displayData); ?>
<?php endif; ?>
<?php endif; ?>
</dl>

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
?>
<?php if (!empty($displayData['item']->associations)) : ?>
<?php $associations = $displayData['item']->associations; ?>
<dd class="association">
<span class="icon-globe icon-fw" aria-hidden="true"></span>
<?php echo Text::_('JASSOCIATIONS'); ?>
<?php foreach ($associations as $association) : ?>
<?php if ($displayData['item']->params->get('flags', 1) && $association['language']->image) : ?>
<?php $flag = HTMLHelper::_('image', 'mod_languages/' . $association['language']->image . '.gif', $association['language']->title_native, ['title' => $association['language']->title_native], true); ?>
<a href="<?php echo Route::_($association['item']); ?>"><?php echo $flag; ?></a>
<?php else : ?>
<?php $class = 'btn btn-secondary btn-sm btn-' . strtolower($association['language']->lang_code); ?>
<a class="<?php echo $class; ?>" title="<?php echo $association['language']->title_native; ?>" href="<?php echo Route::_($association['item']); ?>"><?php echo $association['language']->lang_code; ?>
<span class="visually-hidden"><?php echo $association['language']->title_native; ?></span>
</a>
<?php endif; ?>
<?php endforeach; ?>
</dd>
<?php endif; ?>

View File

@ -0,0 +1,26 @@
<?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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<dd class="createdby">
<span class="icon-user icon-fw" aria-hidden="true"></span>
<?php $author = ($displayData['item']->created_by_alias ?: $displayData['item']->author); ?>
<?php $author = '<span>' . $author . '</span>'; ?>
<?php if (!empty($displayData['item']->contact_link) && $displayData['params']->get('link_author') == true) : ?>
<?php echo Text::sprintf('COM_CONTENT_WRITTEN_BY', HTMLHelper::_('link', $displayData['item']->contact_link, $author)); ?>
<?php else : ?>
<?php echo Text::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php endif; ?>
</dd>

View File

@ -0,0 +1,31 @@
<?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;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Site\Helper\RouteHelper;
?>
<dd class="category-name">
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-folder-open icon-fw']); ?>
<?php $title = $this->escape($displayData['item']->category_title); ?>
<?php if ($displayData['params']->get('link_category') && !empty($displayData['item']->catid)) : ?>
<?php $url = '<a href="' . Route::_(
RouteHelper::getCategoryRoute($displayData['item']->catid, $displayData['item']->category_language)
)
. '">' . $title . '</a>'; ?>
<?php echo Text::sprintf('COM_CONTENT_CATEGORY', $url); ?>
<?php else : ?>
<?php echo Text::sprintf('COM_CONTENT_CATEGORY', '<span>' . $title . '</span>'); ?>
<?php endif; ?>
</dd>

View File

@ -0,0 +1,22 @@
<?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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<dd class="create">
<span class="icon-calendar icon-fw" aria-hidden="true"></span>
<time datetime="<?php echo HTMLHelper::_('date', $displayData['item']->created, 'c'); ?>">
<?php echo Text::sprintf('COM_CONTENT_CREATED_DATE_ON', HTMLHelper::_('date', $displayData['item']->created, Text::_('DATE_FORMAT_LC3'))); ?>
</time>
</dd>

View File

@ -0,0 +1,20 @@
<?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;
?>
<dd class="hits">
<span class="icon-eye icon-fw" aria-hidden="true"></span>
<meta content="UserPageVisits:<?php echo $displayData['item']->hits; ?>">
<?php echo Text::sprintf('COM_CONTENT_ARTICLE_HITS', $displayData['item']->hits); ?>
</dd>

View File

@ -0,0 +1,22 @@
<?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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<dd class="modified">
<span class="icon-calendar icon-fw" aria-hidden="true"></span>
<time datetime="<?php echo HTMLHelper::_('date', $displayData['item']->modified, 'c'); ?>">
<?php echo Text::sprintf('COM_CONTENT_LAST_UPDATED', HTMLHelper::_('date', $displayData['item']->modified, Text::_('DATE_FORMAT_LC3'))); ?>
</time>
</dd>

View File

@ -0,0 +1,31 @@
<?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;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Site\Helper\RouteHelper;
?>
<dd class="parent-category-name">
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-folder icon-fw']); ?>
<?php $title = $this->escape($displayData['item']->parent_title); ?>
<?php if ($displayData['params']->get('link_parent_category') && !empty($displayData['item']->parent_id)) : ?>
<?php $url = '<a href="' . Route::_(
RouteHelper::getCategoryRoute($displayData['item']->parent_id, $displayData['item']->parent_language)
)
. '">' . $title . '</a>'; ?>
<?php echo Text::sprintf('COM_CONTENT_PARENT', $url); ?>
<?php else : ?>
<?php echo Text::sprintf('COM_CONTENT_PARENT', '<span>' . $title . '</span>'); ?>
<?php endif; ?>
</dd>

View File

@ -0,0 +1,22 @@
<?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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<dd class="published">
<span class="icon-calendar icon-fw" aria-hidden="true"></span>
<time datetime="<?php echo HTMLHelper::_('date', $displayData['item']->publish_up, 'c'); ?>">
<?php echo Text::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', HTMLHelper::_('date', $displayData['item']->publish_up, Text::_('DATE_FORMAT_LC3'))); ?>
</time>
</dd>

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\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Site\Helper\RouteHelper;
$params = $displayData->params;
$images = json_decode($displayData->images);
if (empty($images->image_intro)) {
return;
}
$imgclass = empty($images->float_intro) ? $params->get('float_intro') : $images->float_intro;
$layoutAttr = [
'src' => $images->image_intro,
'alt' => empty($images->image_intro_alt) && empty($images->image_intro_alt_empty) ? false : $images->image_intro_alt,
];
?>
<figure class="<?php echo $this->escape($imgclass); ?> item-image">
<?php if ($params->get('link_intro_image') && ($params->get('access-view') || $params->get('show_noauth', '0') == '1')) : ?>
<a href="<?php echo Route::_(RouteHelper::getArticleRoute($displayData->slug, $displayData->catid, $displayData->language)); ?>" title="<?php echo $this->escape($displayData->title); ?>">
<?php echo LayoutHelper::render('joomla.html.image', $layoutAttr); ?>
</a>
<?php else : ?>
<?php echo LayoutHelper::render('joomla.html.image', $layoutAttr); ?>
<?php endif; ?>
<?php if (isset($images->image_intro_caption) && $images->image_intro_caption !== '') : ?>
<figcaption class="caption"><?php echo $this->escape($images->image_intro_caption); ?></figcaption>
<?php endif; ?>
</figure>

View File

@ -0,0 +1,26 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
$item = $displayData;
if ($item->language === '*') {
echo Text::alt('JALL', 'language');
} elseif ($item->language_image) {
echo HTMLHelper::_('image', 'mod_languages/' . $item->language_image . '.gif', '', ['class' => 'me-1'], true) . htmlspecialchars($item->language_title, ENT_COMPAT, 'UTF-8');
} elseif ($item->language_title) {
echo htmlspecialchars($item->language_title, ENT_COMPAT, 'UTF-8');
} else {
echo Text::_('JUNDEFINED');
}

View File

@ -0,0 +1,47 @@
<?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\Form\FormHelper;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
?>
<fieldset class="<?php echo !empty($displayData->formclass) ? $displayData->formclass : ''; ?>">
<legend><?php echo $displayData->name; ?></legend>
<?php if (!empty($displayData->description)) : ?>
<p><?php echo $displayData->description; ?></p>
<?php endif; ?>
<?php $fieldsnames = explode(',', $displayData->fieldsname); ?>
<div class="form-grid">
<?php foreach ($fieldsnames as $fieldname) : ?>
<?php foreach ($displayData->form->getFieldset($fieldname) as $field) : ?>
<?php $datashowon = ''; ?>
<?php $groupClass = $field->type === 'Spacer' ? ' field-spacer' : ''; ?>
<?php if ($field->showon) : ?>
<?php $wa->useScript('showon'); ?>
<?php $datashowon = ' data-showon=\'' . json_encode(FormHelper::parseShowOnConditions($field->showon, $field->formControl, $field->group)) . '\''; ?>
<?php endif; ?>
<?php if (isset($displayData->showlabel)) : ?>
<div class="control-group<?php echo $groupClass; ?>"<?php echo $datashowon; ?>>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php else : ?>
<?php echo $field->renderField(); ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</div>
</fieldset>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2014 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;
$params = $displayData['params'];
$item = $displayData['item'];
$direction = Factory::getLanguage()->isRtl() ? 'left' : 'right';
?>
<p class="readmore">
<?php if (!$params->get('access-view')) : ?>
<a class="btn btn-secondary" href="<?php echo $displayData['link']; ?>" aria-label="<?php echo Text::_('JGLOBAL_REGISTER_TO_READ_MORE') . ' ' . $this->escape($item->title); ?>">
<?php echo '<span class="icon-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php echo Text::_('JGLOBAL_REGISTER_TO_READ_MORE'); ?>
</a>
<?php elseif ($readmore = $item->alternative_readmore) : ?>
<a class="btn btn-secondary" href="<?php echo $displayData['link']; ?>" aria-label="<?php echo $this->escape($readmore . ' ' . $item->title); ?>">
<?php echo '<span class="icon-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php echo $readmore; ?>
<?php if ($params->get('show_readmore_title', 0) != 0) : ?>
<?php echo HTMLHelper::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
<?php endif; ?>
</a>
<?php elseif ($params->get('show_readmore_title', 0) == 0) : ?>
<a class="btn btn-secondary" href="<?php echo $displayData['link']; ?>" aria-label="<?php echo Text::sprintf('JGLOBAL_READ_MORE_TITLE', $this->escape($item->title)); ?>">
<?php echo '<span class="icon-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php echo Text::_('JGLOBAL_READ_MORE'); ?>
</a>
<?php else : ?>
<a class="btn btn-secondary" href="<?php echo $displayData['link']; ?>" aria-label="<?php echo Text::sprintf('JGLOBAL_READ_MORE_TITLE', $this->escape($item->title)); ?>">
<?php echo '<span class="icon-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php echo Text::sprintf('JGLOBAL_READ_MORE_TITLE', HTMLHelper::_('string.truncate', $item->title, $params->get('readmore_limit'))); ?>
</a>
<?php endif; ?>
</p>

View File

@ -0,0 +1,35 @@
<?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\Router\Route;
use Joomla\Component\Tags\Site\Helper\RouteHelper;
use Joomla\Registry\Registry;
$authorised = Factory::getUser()->getAuthorisedViewLevels();
?>
<?php if (!empty($displayData)) : ?>
<ul class="tags list-inline">
<?php foreach ($displayData as $i => $tag) : ?>
<?php if (in_array($tag->access, $authorised)) : ?>
<?php $tagParams = new Registry($tag->params); ?>
<?php $link_class = $tagParams->get('tag_link_class', 'btn-info'); ?>
<li class="list-inline-item tag-<?php echo $tag->tag_id; ?> tag-list<?php echo $i; ?>">
<a href="<?php echo Route::_(RouteHelper::getComponentTagRoute($tag->tag_id . ':' . $tag->alias, $tag->language)); ?>" class="btn btn-sm <?php echo $link_class; ?>">
<?php echo $this->escape($tag->title); ?>
</a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>

View File

@ -0,0 +1,41 @@
<?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\Language\Text;
?>
<fieldset class="<?php echo !empty($displayData->formclass) ? $displayData->formclass : 'form-horizontal'; ?>">
<legend><?php echo $displayData->name; ?></legend>
<details>
<summary class="filter-notes"><?php echo Text::_('COM_CONFIG_TEXT_FILTERS_SUMMARY'); ?></summary>
<div class="filter-notes"><?php echo Text::_('COM_CONFIG_TEXT_FILTERS_DESC'); ?></div>
</details>
<details>
<summary class="filter-notes"><?php echo Text::_('JGLOBAL_FILTER_TYPE_LABEL'); ?></summary>
<div class="filter-notes"><?php echo Text::_('JGLOBAL_FILTER_TYPE_DESC'); ?></div>
</details>
<details>
<summary class="filter-notes"><?php echo Text::_('JGLOBAL_FILTER_TAGS_LABEL'); ?></summary>
<div class="filter-notes"><?php echo Text::_('JGLOBAL_FILTER_TAGS_DESC'); ?></div>
</details>
<details>
<summary class="filter-notes"><?php echo Text::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL'); ?></summary>
<div class="filter-notes"><?php echo Text::_('JGLOBAL_FILTER_ATTRIBUTES_DESC'); ?></div>
</details>
<?php $fieldsnames = explode(',', $displayData->fieldsname); ?>
<?php foreach ($fieldsnames as $fieldname) : ?>
<?php foreach ($displayData->form->getFieldset($fieldname) as $field) : ?>
<div class="table-responsive"><?php echo $field->input; ?></div>
<?php endforeach; ?>
<?php endforeach; ?>
</fieldset>

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>

View File

@ -0,0 +1,28 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2014 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;
$buttons = $displayData;
?>
<div class="editor-xtd-buttons" role="toolbar" aria-label="<?php echo Text::_('JTOOLBAR'); ?>">
<?php if ($buttons) : ?>
<?php foreach ($buttons as $button) :
$options = (array) $button->get('options');
$legacyModal = $button->get('modal');
?>
<?php echo $this->sublayout('button', $button); ?>
<?php echo $legacyModal ? $this->sublayout('modal', $button) : ''; ?>
<?php endforeach; ?>
<?php endif; ?>
</div>

View File

@ -0,0 +1,74 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2014 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\Uri\Uri;
/** @var \Joomla\CMS\Editor\Button\Button $button */
$button = $displayData;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$btnAsset = 'editor-button.' . $button->getButtonName();
// Enable the button assets if any
if ($wa->assetExists('style', $btnAsset)) {
$wa->useStyle($btnAsset);
}
if ($wa->assetExists('script', $btnAsset)) {
$wa->useScript($btnAsset);
}
$class = 'btn btn-secondary';
$class .= $button->get('class') ? ' ' . $button->get('class') : null;
$class .= $button->get('modal') ? ' modal-button' : null;
$href = '#' . $button->get('editor') . '_' . strtolower($button->get('name', '')) . '_modal';
$link = $button->get('link');
$onclick = $button->get('onclick') ? ' onclick="' . $button->get('onclick') . '"' : '';
$title = $button->get('title') ? $button->get('title') : $button->get('text', '');
$icon = $button->get('icon');
$action = $button->get('action', '');
$options = (array) $button->get('options');
// Correct the link, check for legacy with &amp; in it, and prepend a base Uri
if ($link && $link[0] !== '#') {
$link = str_contains($link, '&amp;') ? htmlspecialchars_decode($link) : $link;
$link = Uri::base(true) . '/' . $link;
$options['src'] = $options['src'] ?? $link;
}
// Detect a legacy BS modal, and set action to "modal" for legacy buttons, when possible
$legacyModal = $button->get('modal');
// Prepare default values for modal
if ($action === 'modal') {
$wa->useScript('joomla.dialog');
$legacyModal = false;
$options['popupType'] = $options['popupType'] ?? 'iframe';
$options['textHeader'] = $options['textHeader'] ?? $title;
$options['iconHeader'] = $options['iconHeader'] ?? 'icon-' . $icon;
}
$optStr = $options && $action ? json_encode($options, JSON_UNESCAPED_SLASHES) : '';
?>
<button type="button" data-joomla-editor-button-action="<?php echo $this->escape($action); ?>" data-joomla-editor-button-options="<?php echo $this->escape($optStr); ?>"
class="xtd-button btn btn-secondary <?php echo $class; ?>" title="<?php echo $this->escape($title); ?>" <?php echo $onclick; ?>
<?php echo $legacyModal ? 'data-bs-toggle="modal" data-bs-target="' . $href . '"' : '' ?>>
<?php if ($icon) : ?>
<span class="icon-<?php echo $icon; ?>" aria-hidden="true"></span>
<?php endif; ?>
<?php echo $button->get('text'); ?>
</button>

View File

@ -0,0 +1,60 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
/** @var \Joomla\CMS\Editor\Button\Button $button */
$button = $displayData;
if (!$button->get('modal')) {
return;
}
$class = ($button->get('class')) ? $button->get('class') : null;
$class .= ($button->get('modal')) ? ' modal-button' : null;
$href = '#' . $button->get('editor') . '_' . strtolower($button->get('name')) . '_modal';
$link = ($button->get('link')) ? Uri::base() . $button->get('link') : null;
$onclick = ($button->get('onclick')) ? ' onclick="' . $button->get('onclick') . '"' : '';
$title = ($button->get('title')) ? $button->get('title') : $button->get('text');
$options = $button->getOptions();
$confirm = '';
if (is_array($button->get('options')) && isset($options['confirmText']) && isset($options['confirmCallback'])) {
$confirm = '<button type="button" class="btn btn-success" data-bs-dismiss="modal" onclick="' . $options['confirmCallback'] . '">'
. $options['confirmText'] . ' </button>';
}
if (null !== $button->get('id')) {
$id = str_replace(' ', '', $button->get('id'));
} else {
$id = $button->get('editor') . '_' . strtolower($button->get('name')) . '_modal';
}
// @todo: J4: Move Make buttons fullscreen on smaller devices per https://github.com/joomla/joomla-cms/pull/23091
// Create the modal
echo HTMLHelper::_(
'bootstrap.renderModal',
$id,
[
'url' => $link,
'title' => $title,
'height' => array_key_exists('height', $options) ? $options['height'] : '400px',
'width' => array_key_exists('width', $options) ? $options['width'] : '800px',
'bodyHeight' => array_key_exists('bodyHeight', $options) ? $options['bodyHeight'] : '70',
'modalWidth' => array_key_exists('modalWidth', $options) ? $options['modalWidth'] : '80',
'footer' => $confirm . '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">'
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
]
);

View File

@ -0,0 +1,68 @@
<?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\HTML\HTMLHelper;
/** @var $displayData array */
$backtraceList = $displayData['backtrace'];
if (!$backtraceList) {
return;
}
$class = $displayData['class'] ?? 'table table-striped table-bordered';
?>
<h2 id="caption">Call Stack</h2>
<table class="<?php echo $class ?>" aria-describedby="caption">
<thead>
<tr>
<th scope="col">
<strong>#</strong>
</th>
<th scope="col">
<strong>Function</strong>
</th>
<th scope="col">
<strong>Location</strong>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($backtraceList as $k => $backtrace) : ?>
<tr>
<td>
<?php echo $k + 1; ?>
</td>
<?php if (isset($backtrace['class'])) : ?>
<td>
<?php echo $backtrace['class'] . $backtrace['type'] . $backtrace['function'] . '()'; ?>
</td>
<?php else : ?>
<td>
<?php echo $backtrace['function'] . '()'; ?>
</td>
<?php endif; ?>
<?php if (isset($backtrace['file'])) : ?>
<td>
<?php echo HTMLHelper::_('debug.xdebuglink', $backtrace['file'], $backtrace['line']); ?>
</td>
<?php else : ?>
<td>
&#160;
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,180 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
use Joomla\Utilities\ArrayHelper;
extract($displayData);
// Get some system objects.
$document = Factory::getApplication()->getDocument();
$lang = Factory::getApplication()->getLanguage();
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*
* Calendar Specific
* @var string $helperPath The relative path for the helper file
* @var string $minYear The minimum year, that will be subtracted/added to current year
* @var string $maxYear The maximum year, that will be subtracted/added to current year
* @var integer $todaybutton The today button
* @var integer $weeknumbers The week numbers display
* @var integer $showtime The time selector display
* @var integer $filltable The previous/next month filling
* @var integer $timeformat The time format
* @var integer $singleheader Display different header row for month/year
* @var string $direction The document direction
* @var string $calendar The calendar type
* @var array $weekend The weekends days
* @var integer $firstday The first day of the week
* @var string $format The format of date and time
*/
$inputvalue = '';
// Build the attributes array.
$attributes = [];
empty($size) ? null : $attributes['size'] = $size;
empty($maxlength) ? null : $attributes['maxlength'] = $maxLength;
empty($class) ? $attributes['class'] = 'form-control' : $attributes['class'] = 'form-control ' . $class;
!$readonly ? null : $attributes['readonly'] = 'readonly';
!$disabled ? null : $attributes['disabled'] = 'disabled';
empty($onchange) ? null : $attributes['onchange'] = $onchange;
if ($required) {
$attributes['required'] = '';
}
// Handle the special case for "now".
if (strtoupper($value) === 'NOW') {
$value = Factory::getDate()->format('Y-m-d H:i:s');
}
$readonly = isset($attributes['readonly']) && $attributes['readonly'] === 'readonly';
$disabled = isset($attributes['disabled']) && $attributes['disabled'] === 'disabled';
if (is_array($attributes)) {
$attributes = ArrayHelper::toString($attributes);
}
$calendarAttrs = [
'data-inputfield' => $id,
'data-button' => $id . '_btn',
'data-date-format' => $format,
'data-firstday' => empty($firstday) ? '' : $firstday,
'data-weekend' => empty($weekend) ? '' : implode(',', $weekend),
'data-today-btn' => $todaybutton,
'data-week-numbers' => $weeknumbers,
'data-show-time' => $showtime,
'data-show-others' => $filltable,
'data-time24' => $timeformat,
'data-only-months-nav' => $singleheader,
'data-min-year' => $minYear,
'data-max-year' => $maxYear,
'data-date-type' => strtolower($calendar),
];
$calendarAttrsStr = ArrayHelper::toString($calendarAttrs);
// Add language strings
$strings = [
// Days
'SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY',
// Short days
'SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT',
// Months
'JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER',
// Short months
'JANUARY_SHORT', 'FEBRUARY_SHORT', 'MARCH_SHORT', 'APRIL_SHORT', 'MAY_SHORT', 'JUNE_SHORT',
'JULY_SHORT', 'AUGUST_SHORT', 'SEPTEMBER_SHORT', 'OCTOBER_SHORT', 'NOVEMBER_SHORT', 'DECEMBER_SHORT',
// Buttons
'JCLOSE', 'JCLEAR', 'JLIB_HTML_BEHAVIOR_TODAY',
// Miscellaneous
'JLIB_HTML_BEHAVIOR_WK',
];
foreach ($strings as $c) {
Text::script($c);
}
// These are new strings. Make sure they exist. Can be generalised at later time: eg in 4.1 version.
if ($lang->hasKey('JLIB_HTML_BEHAVIOR_AM')) {
Text::script('JLIB_HTML_BEHAVIOR_AM');
}
if ($lang->hasKey('JLIB_HTML_BEHAVIOR_PM')) {
Text::script('JLIB_HTML_BEHAVIOR_PM');
}
// Redefine locale/helper assets to use correct path, and load calendar assets
$document->getWebAssetManager()
->registerAndUseScript('field.calendar.helper', $helperPath, [], ['defer' => true])
->useStyle('field.calendar' . ($direction === 'rtl' ? '-rtl' : ''))
->useScript('field.calendar');
?>
<div class="field-calendar">
<?php if (!$readonly && !$disabled) : ?>
<div class="input-group">
<?php endif; ?>
<input
type="text"
id="<?php echo $id; ?>"
name="<?php echo $name; ?>"
value="<?php echo htmlspecialchars(($value !== '0000-00-00 00:00:00') ? $value : '', ENT_COMPAT, 'UTF-8'); ?>"
<?php echo !empty($description) ? ' aria-describedby="' . ($id ?: $name) . '-desc"' : ''; ?>
<?php echo $attributes; ?>
<?php echo $dataAttribute ?? ''; ?>
<?php echo !empty($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : ''; ?>
data-alt-value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>" autocomplete="off">
<button type="button" class="<?php echo ($readonly || $disabled) ? 'hidden ' : ''; ?>btn btn-primary"
id="<?php echo $id; ?>_btn"
title="<?php echo Text::_('JLIB_HTML_BEHAVIOR_OPEN_CALENDAR'); ?>"
<?php echo $calendarAttrsStr; ?>
><span class="icon-calendar" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('JLIB_HTML_BEHAVIOR_OPEN_CALENDAR'); ?></span>
</button>
<?php if (!$readonly && !$disabled) : ?>
</div>
<?php endif; ?>
</div>

View File

@ -0,0 +1,71 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2019 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\Form\Field\CheckboxField;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string|null $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var CheckboxField $field The form field object.
* @var string|null $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var string $validationtext The validation text of invalid value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var boolean $checked Whether the checkbox should be checked.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
// Initialize some field attributes.
$class = $class ? ' ' . $class : '';
$disabled = $disabled ? ' disabled' : '';
$required = $required ? ' required' : '';
$autofocus = $autofocus ? ' autofocus' : '';
$checked = $checked ? ' checked' : '';
// Initialize JavaScript field attributes.
$onclick = $onclick ? ' onclick="' . $onclick . '"' : '';
$onchange = $onchange ? ' onchange="' . $onchange . '"' : '';
?>
<div class="form-check form-check-inline">
<input
type="checkbox"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
class="form-check-input<?php echo $class; ?>"
value="<?php echo htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); ?>"
<?php echo $checked . $disabled . $onclick . $onchange . $required . $autofocus . $dataAttribute; ?>
>
</div>

View File

@ -0,0 +1,92 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
/**
* The format of the input tag to be filled in using sprintf.
* %1 - id
* %2 - name
* %3 - value
* %4 = any other attributes
*/
$format = '<input type="checkbox" id="%1$s" name="%2$s" value="%3$s" %4$s>';
// The alt option for Text::alt
$alt = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $name);
?>
<fieldset id="<?php echo $id; ?>" class="<?php echo trim($class . ' checkboxes'); ?>"
<?php echo $required ? 'required' : ''; ?>
<?php echo $autofocus ? 'autofocus' : ''; ?>
<?php echo $dataAttribute; ?>>
<legend class="visually-hidden"><?php echo $label; ?></legend>
<?php foreach ($options as $i => $option) : ?>
<?php
// Initialize some option attributes.
$checked = in_array((string) $option->value, $checkedOptions, true) ? 'checked' : '';
// In case there is no stored value, use the option's default state.
$checked = (!$hasValue && $option->checked) ? 'checked' : $checked;
$optionClass = !empty($option->class) ? 'class="form-check-input ' . $option->class . '"' : ' class="form-check-input"';
$optionDisabled = !empty($option->disable) || $disabled ? 'disabled' : '';
// Initialize some JavaScript option attributes.
$onclick = !empty($option->onclick) ? 'onclick="' . $option->onclick . '"' : '';
$onchange = !empty($option->onchange) ? 'onchange="' . $option->onchange . '"' : '';
$oid = $id . $i;
$value = htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8');
$attributes = array_filter([$checked, $optionClass, $optionDisabled, $onchange, $onclick]);
?>
<div class="form-check form-check-inline">
<?php echo sprintf($format, $oid, $name, $value, implode(' ', $attributes)); ?>
<label for="<?php echo $oid; ?>" class="form-check-label">
<?php echo $option->text; ?>
</label>
</div>
<?php endforeach; ?>
</fieldset>

View File

@ -0,0 +1,97 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var integer $size Size attribute of the input.
* @var boolean $spellchec Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $checked Is this field checked?
* @var array $position Position of input.
* @var string $control The forms control.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
if ($validate !== 'color' && in_array($format, ['rgb', 'rgba'], true)) {
$alpha = ($format === 'rgba');
$placeholder = $alpha ? 'rgba(0, 0, 0, 0.5)' : 'rgb(0, 0, 0)';
} else {
$placeholder = '#rrggbb';
}
$inputclass = ($keywords && ! in_array($format, ['rgb', 'rgba'], true)) ? ' keywords' : ' ' . $format;
$class = ' class="form-control ' . trim('minicolors ' . $class) . ($validate === 'color' ? '' : $inputclass) . '"';
$control = $control ? ' data-control="' . $control . '"' : '';
$format = $format ? ' data-format="' . $format . '"' : '';
$keywords = $keywords ? ' data-keywords="' . $keywords . '"' : '';
$colors = $colors ? ' data-colors="' . $colors . '"' : '';
$validate = $validate ? ' data-validate="' . $validate . '"' : '';
$disabled = $disabled ? ' disabled' : '';
$readonly = $readonly ? ' readonly' : '';
$hint = strlen($hint) ? ' placeholder="' . $this->escape($hint) . '"' : ' placeholder="' . $placeholder . '"';
$onchange = $onchange ? ' onchange="' . $onchange . '"' : '';
$required = $required ? ' required' : '';
$autocomplete = !empty($autocomplete) ? ' autocomplete="' . $autocomplete . '"' : '';
// Force LTR input value in RTL, due to display issues with rgba/hex colors
$direction = $lang->isRtl() ? ' dir="ltr" style="text-align:right"' : '';
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->usePreset('minicolors')
->useScript('field.color-adv');
?>
<input type="text" name="<?php echo $name; ?>" id="<?php echo $id; ?>" value="<?php echo $this->escape($color); ?>"<?php
echo $hint,
$class,
$position,
$control,
$readonly,
$disabled,
$required,
$onchange,
$autocomplete,
$autofocus,
$format,
$keywords,
$direction,
$validate,
$dataAttribute;
?>/>

View File

@ -0,0 +1,72 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellchec Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $checked Is this field checked?
* @var array $position Position of input.
* @var array $control The forms control.
* @var array $colors The specified colors
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
$class = ' class="form-select ' . trim($class) . '"';
$disabled = $disabled ? ' disabled' : '';
$readonly = $readonly ? ' readonly' : '';
Factory::getDocument()->getWebAssetManager()
->useStyle('webcomponent.field-simple-color')
->useScript('webcomponent.field-simple-color');
?>
<joomla-field-simple-color text-select="<?php echo Text::_('JFIELD_COLOR_SELECT'); ?>" text-color="<?php echo Text::_('JFIELD_COLOR_VALUE'); ?>" text-close="<?php echo Text::_('JLIB_HTML_BEHAVIOR_CLOSE'); ?>" text-transparent="<?php echo Text::_('JFIELD_COLOR_TRANSPARENT'); ?>">
<select name="<?php echo $name; ?>" id="<?php echo $id; ?>"<?php
echo $disabled; ?><?php echo $readonly; ?><?php echo $dataAttribute; ?><?php echo $required; ?><?php echo $class; ?><?php echo $position; ?><?php
echo $onchange; ?><?php echo $autofocus; ?> style="visibility:hidden;width:22px;height:1px">
<?php foreach ($colors as $i => $c) : ?>
<option<?php echo ($c === $color ? ' selected="selected"' : ''); ?> value="<?php echo $c; ?>"></option>
<?php endforeach; ?>
</select>
</joomla-field-simple-color>

View File

@ -0,0 +1,157 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* @var array $displayData Data for this field collected by ColorField
*/
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input
* @var boolean $disabled Is this field disabled?
* @var string $display Which kind of slider should be displayed?
* @var string $default Default value for this field
* @var string $format Format of color value
* @var string $hint Text for inputs placeholder
* @var string $id ID of field and label
* @var string $name Name of the input field
* @var string $onchange Onchange attribute for the field
* @var string $onclick Onclick attribute for the field
* @var string $position Position of input
* @var boolean $preview Should the selected value be displayed separately?
* @var boolean $readonly Is this field read only?
* @var boolean $required Is this field required?
* @var string $saveFormat Format to save the color
* @var integer $size Size attribute of the input
* @var string $validate Validation rules to apply.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
if ($color === 'none' || is_null($color)) {
$color = '';
}
$alpha = $format === 'hsla' || $format === 'rgba' || $format === 'alpha';
$autocomplete = !empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '';
$autofocus = $autofocus ? ' autofocus' : '';
$color = ' data-color="' . $color . '"';
$class = $class ? ' class="' . $class . '"' : '';
$default = $default ? ' data-default="' . $default . '"' : '';
$disabled = $disabled ? ' disabled' : '';
$format = $format ? ' data-format="' . $format . '"' : '';
$hint = strlen($hint) ? ' placeholder="' . $this->escape($hint) . '"' : '';
$onchange = $onchange ? ' onchange="' . $onchange . '"' : '';
$onclick = $onclick ? ' onclick="' . $onclick . '"' : '';
$preview = $preview ? ' data-preview="' . $preview . '"' : '';
$readonly = $readonly ? ' readonly' : '';
$saveFormat = $saveFormat ? ' data-format="' . $saveFormat . '"' : '';
$size = $size ? ' size="' . $size . '"' : '';
$validate = $validate ? ' data-validate="' . $validate . '"' : '';
$displayValues = explode(',', $display);
$allSliders = $display === 'full' || empty($display);
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('field.color-slider');
Text::script('JFIELD_COLOR_ERROR_CONVERT_HSL');
Text::script('JFIELD_COLOR_ERROR_CONVERT_HUE');
Text::script('JFIELD_COLOR_ERROR_NO_COLOUR');
Text::script('JFIELD_COLOR_ERROR_WRONG_FORMAT');
?>
<div class="color-slider-wrapper"
<?php echo
$class,
$color,
$default,
$preview,
$size,
$dataAttribute;
?>
>
<!-- The data to save at the end (label created in form by Joomla) -->
<input type="text" class="form-control color-input" id="<?php echo $id; ?>" name="<?php echo $name; ?>"
<?php echo
$disabled,
$readonly,
$required,
$saveFormat,
$validate;
?>
>
<!-- Shows value which is allowed to manipulate like 'hue' -->
<label for="slider-input" class="visually-hidden"><?php echo Text::_('JFIELD_COLOR_LABEL_SLIDER_INPUT'); ?></label>
<input type="text" class="form-control" id="slider-input"
<?php echo
$autocomplete,
$disabled,
$hint,
$onchange,
$onclick,
$position,
$readonly,
$required,
$format,
$validate;
?>
>
<span class="form-control-feedback"></span>
<?php if ($allSliders || in_array('hue', $displayValues)) : ?>
<label for="hue-slider" class="visually-hidden"><?php echo Text::_('JFIELD_COLOR_LABEL_SLIDER_HUE'); ?></label>
<input type="range" min="0" max="360" class="form-control color-slider" id="hue-slider" data-type="hue"
<?php echo
$autofocus,
$disabled
?>
>
<?php endif ?>
<?php if ($allSliders || in_array('saturation', $displayValues)) : ?>
<label for="saturation-slider" class="visually-hidden"><?php echo Text::_('JFIELD_COLOR_LABEL_SLIDER_SATURATION'); ?></label>
<input type="range" min="0" max="100" class="form-control color-slider" id="saturation-slider" data-type="saturation"
<?php echo
$autofocus,
$disabled
?>
>
<?php endif ?>
<?php if ($allSliders || in_array('light', $displayValues)) : ?>
<label for="light-slider" class="visually-hidden"><?php echo Text::_('JFIELD_COLOR_LABEL_SLIDER_LIGHT'); ?></label>
<input type="range" min="0" max="100" class="form-control color-slider" id="light-slider" data-type="light"
<?php echo
$autofocus,
$disabled
?>
>
<?php endif ?>
<?php if ($alpha && ($allSliders || in_array('alpha', $displayValues))) : ?>
<label for="alpha-slider" class="visually-hidden"><?php echo Text::_('JFIELD_COLOR_LABEL_SLIDER_ALPHA'); ?></label>
<input type="range" min="0" max="100" class="form-control color-slider" id="alpha-slider" data-type="alpha"
<?php echo
$autofocus,
$disabled
?>
>
<?php endif ?>
</div>

View File

@ -0,0 +1,77 @@
<?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;
extract($displayData);
use Joomla\CMS\HTML\HTMLHelper;
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $options Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
HTMLHelper::_('behavior.combobox');
$attr = '';
// Initialize some field attributes.
$attr .= !empty($class) ? ' class="awesomplete form-control ' . $class . '"' : ' class="awesomplete form-control"';
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
$attr .= !empty($readonly) ? ' readonly' : '';
$attr .= !empty($disabled) ? ' disabled' : '';
$attr .= !empty($required) ? ' required' : '';
$attr .= !empty($description) ? ' aria-describedby="' . ($id ?: $name) . '-desc"' : '';
// Initialize JavaScript field attributes.
$attr .= !empty($onchange) ? ' onchange="' . $onchange . '"' : '';
$val = [];
foreach ($options as $option) {
$val[] = $option->text;
}
?>
<input
type="text"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo $attr; ?>
data-list="<?php echo implode(', ', $val); ?>"
<?php echo $dataAttribute; ?>
/>

View File

@ -0,0 +1,78 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var string $link The link for the content history page
* @var string $label The label text
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
echo HTMLHelper::_(
'bootstrap.renderModal',
'versionsModal',
[
'url' => Route::_($link),
'title' => $label,
'height' => '100%',
'width' => '100%',
'modalWidth' => '80',
'bodyHeight' => '60',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
]
);
?>
<button
type="button"
class="btn btn-secondary"
data-bs-toggle="modal"
data-bs-target="#versionsModal"
<?php echo $dataAttribute; ?>>
<span class="icon-code-branch" aria-hidden="true"></span>
<?php echo $label; ?>
</button>

View File

@ -0,0 +1,74 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\String\PunycodeHelper;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
$attributes = [
'type="email"',
'inputmode="email"',
'name="' . $name . '"',
'class="form-control validate-email' . (!empty($class) ? ' ' . $class : '') . '"',
'id="' . $id . '"',
'value="' . htmlspecialchars(PunycodeHelper::emailToUTF8($value), ENT_COMPAT, 'UTF-8') . '"',
$spellcheck ? '' : 'spellcheck="false"',
!empty($size) ? 'size="' . $size . '"' : '',
!empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
$onchange ? 'onchange="' . $onchange . '"' : '',
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$multiple ? 'multiple' : '',
!empty($maxLength) ? 'maxlength="' . $maxLength . '"' : '',
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
$required ? 'required' : '',
$autofocus ? 'autofocus' : '',
$dataAttribute,
];
echo '<input ' . implode(' ', array_values(array_filter($attributes))) . '>';

View File

@ -0,0 +1,69 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Utility\Utility;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
*/
$maxSize = HTMLHelper::_('number.bytes', Utility::getMaxUploadSize());
?>
<input type="file"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
<?php echo !empty($size) ? ' size="' . $size . '"' : ''; ?>
<?php echo !empty($accept) ? ' accept="' . $accept . '"' : ''; ?>
<?php echo !empty($class) ? ' class="form-control ' . $class . '"' : ' class="form-control"'; ?>
<?php echo !empty($multiple) ? ' multiple' : ''; ?>
<?php echo $disabled ? ' disabled' : ''; ?>
<?php echo $autofocus ? ' autofocus' : ''; ?>
<?php echo $dataAttribute; ?>
<?php echo !empty($onchange) ? ' onchange="' . $onchange . '"' : ''; ?>
<?php echo $required ? ' required' : ''; ?>><br>
<?php echo Text::sprintf('JGLOBAL_MAXIMUM_UPLOAD_SIZE_LIMIT', $maxSize); ?>

View File

@ -0,0 +1,122 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2021 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $groups Groups of options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
*/
$html = [];
$attr = '';
// Initialize some field attributes.
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
$attr .= $multiple ? ' multiple' : '';
$attr .= $autofocus ? ' autofocus' : '';
$attr .= $dataAttribute;
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ($readonly || $disabled) {
$attr .= ' disabled="disabled"';
}
// Initialize JavaScript field attributes.
$attr .= !empty($onchange) ? ' onchange="' . $onchange . '"' : '';
$attr2 = '';
$attr2 .= !empty($class) ? ' class="' . $class . '"' : '';
$attr2 .= ' placeholder="' . $this->escape($hint ?: Text::_('JGLOBAL_TYPE_OR_SELECT_SOME_OPTIONS')) . '" ';
if ($required) {
$attr .= ' required class="required"';
$attr2 .= ' required';
}
// Create a read-only list (no name) with a hidden input to store the value.
if ($readonly) {
$html[] = HTMLHelper::_(
'select.groupedlist',
$groups,
null,
[
'list.attr' => $attr, 'id' => $id, 'list.select' => $value, 'group.items' => null, 'option.key.toHtml' => false,
'option.text.toHtml' => false,
]
);
// E.g. form field type tag sends $this->value as array
if ($multiple && \is_array($value)) {
if (!\count($value)) {
$value[] = '';
}
foreach ($value as $val) {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">';
}
} else {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">';
}
} else {
// Create a regular list.
$html[] = HTMLHelper::_(
'select.groupedlist',
$groups,
$name,
[
'list.attr' => $attr, 'id' => $id, 'list.select' => $value, 'group.items' => null, 'option.key.toHtml' => false,
'option.text.toHtml' => false,
]
);
}
Text::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
Text::script('JGLOBAL_SELECT_PRESS_TO_SELECT');
Factory::getApplication()->getDocument()->getWebAssetManager()
->usePreset('choicesjs')
->useScript('webcomponent.field-fancy-select');
?>
<joomla-field-fancy-select <?php echo $attr2; ?>><?php echo implode($html); ?></joomla-field-fancy-select>

View File

@ -0,0 +1,104 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2021 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\HTML\HTMLHelper;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $groups Groups of options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
*/
$html = [];
$attr = '';
// Initialize some field attributes.
$attr .= !empty($class) ? ' class="form-select ' . $class . '"' : ' class="form-select"';
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
$attr .= $multiple ? ' multiple' : '';
$attr .= $required ? ' required' : '';
$attr .= $autofocus ? ' autofocus' : '';
$attr .= $dataAttribute;
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ($readonly || $disabled) {
$attr .= ' disabled="disabled"';
}
// Initialize JavaScript field attributes.
$attr .= !empty($onchange) ? ' onchange="' . $onchange . '"' : '';
// Create a read-only list (no name) with a hidden input to store the value.
if ($readonly) {
$html[] = HTMLHelper::_(
'select.groupedlist',
$groups,
null,
[
'list.attr' => $attr, 'id' => $id, 'list.select' => $value, 'group.items' => null, 'option.key.toHtml' => false,
'option.text.toHtml' => false,
]
);
// E.g. form field type tag sends $this->value as array
if ($multiple && \is_array($value)) {
if (!\count($value)) {
$value[] = '';
}
foreach ($value as $val) {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">';
}
} else {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">';
}
} else {
// Create a regular list.
$html[] = HTMLHelper::_(
'select.groupedlist',
$groups,
$name,
[
'list.attr' => $attr, 'id' => $id, 'list.select' => $value, 'group.items' => null, 'option.key.toHtml' => false,
'option.text.toHtml' => false,
]
);
}
echo implode($html);

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
*/
// Initialize some field attributes.
$class = !empty($class) ? ' class="' . $class . '"' : '';
$disabled = $disabled ? ' disabled' : '';
$onchange = $onchange ? ' onchange="' . $onchange . '"' : '';
?>
<input
type="hidden"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo $class, $disabled, $onchange, $dataAttribute; ?>>

View File

@ -0,0 +1,104 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2018 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $options Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
*/
$html = [];
$attr = '';
// Initialize the field attributes.
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
$attr .= $multiple ? ' multiple' : '';
$attr .= $autofocus ? ' autofocus' : '';
$attr .= $onchange ? ' onchange="' . $onchange . '"' : '';
$attr .= $dataAttribute;
// To avoid user's confusion, readonly="readonly" should imply disabled="disabled".
if ($readonly || $disabled) {
$attr .= ' disabled="disabled"';
}
$attr2 = '';
$attr2 .= !empty($class) ? ' class="' . $class . '"' : '';
$attr2 .= ' placeholder="' . $this->escape($hint ?: Text::_('JGLOBAL_TYPE_OR_SELECT_SOME_OPTIONS')) . '" ';
if ($required) {
$attr .= ' required class="required"';
$attr2 .= ' required';
}
// Create a read-only list (no name) with hidden input(s) to store the value(s).
if ($readonly) {
$html[] = HTMLHelper::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $value, $id);
// E.g. form field type tag sends $this->value as array
if ($multiple && is_array($value)) {
if (!count($value)) {
$value[] = '';
}
foreach ($value as $val) {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">';
}
} else {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">';
}
} else // Create a regular list.
{
$html[] = HTMLHelper::_('select.genericlist', $options, $name, trim($attr), 'value', 'text', $value, $id);
}
Text::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
Text::script('JGLOBAL_SELECT_PRESS_TO_SELECT');
Factory::getApplication()->getDocument()->getWebAssetManager()
->usePreset('choicesjs')
->useScript('webcomponent.field-fancy-select');
?>
<joomla-field-fancy-select <?php echo $attr2; ?>><?php echo implode($html); ?></joomla-field-fancy-select>

View File

@ -0,0 +1,95 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2018 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\HTML\HTMLHelper;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $options Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
*/
$html = [];
$attr = '';
// Initialize the field attributes.
$attr .= !empty($class) ? ' class="form-select ' . $class . '"' : ' class="form-select"';
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
$attr .= $multiple ? ' multiple' : '';
$attr .= $required ? ' required' : '';
$attr .= $autofocus ? ' autofocus' : '';
$attr .= $onchange ? ' onchange="' . $onchange . '"' : '';
$attr .= !empty($description) ? ' aria-describedby="' . ($id ?: $name) . '-desc"' : '';
$attr .= $dataAttribute;
// To avoid user's confusion, readonly="readonly" should imply disabled="disabled".
if ($readonly || $disabled) {
$attr .= ' disabled="disabled"';
}
// Create a read-only list (no name) with hidden input(s) to store the value(s).
if ($readonly) {
$html[] = HTMLHelper::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $value, $id);
// E.g. form field type tag sends $this->value as array
if ($multiple && is_array($value)) {
if (!count($value)) {
$value[] = '';
}
foreach ($value as $val) {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">';
}
} else {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">';
}
} else // Create a regular list passing the arguments in an array.
{
$listoptions = [];
$listoptions['option.key'] = 'value';
$listoptions['option.text'] = 'text';
$listoptions['list.select'] = $value;
$listoptions['id'] = $id;
$listoptions['list.translate'] = false;
$listoptions['option.attr'] = 'optionattr';
$listoptions['list.attr'] = trim($attr);
$html[] = HTMLHelper::_('select.genericlist', $options, $name, $listoptions);
}
echo implode($html);

View File

@ -0,0 +1,203 @@
<?php
/**
* @package Joomla.Admin
* @subpackage Layout
*
* @copyright (C) 2015 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\Helper\MediaHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $asset The asset text
* @var string $authorField The label text
* @var integer $authorId The author id
* @var string $class The class text
* @var boolean $disabled True if field is disabled
* @var string $folder The folder text
* @var string $id The label text
* @var string $link The link text
* @var string $name The name text
* @var string $preview The preview image relative path
* @var integer $previewHeight The image preview height
* @var integer $previewWidth The image preview width
* @var string $onchange The onchange text
* @var boolean $readonly True if field is readonly
* @var integer $size The size text
* @var string $value The value text
* @var string $src The path and filename of the image
* @var array $mediaTypes The supported media types for the Media Manager
* @var array $imagesExt The supported extensions for images
* @var array $audiosExt The supported extensions for audios
* @var array $videosExt The supported extensions for videos
* @var array $documentsExt The supported extensions for documents
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
*/
$attr = '';
// Initialize some field attributes.
$attr .= !empty($class) ? ' class="form-control field-media-input ' . $class . '"' : ' class="form-control field-media-input"';
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
$attr .= $dataAttribute;
// Initialize JavaScript field attributes.
$attr .= !empty($onchange) ? ' onchange="' . $onchange . '"' : '';
switch ($preview) {
case 'no': // Deprecated parameter value
case 'false':
case 'none':
$showPreview = false;
break;
case 'yes': // Deprecated parameter value
case 'true':
case 'show':
case 'tooltip':
default:
$showPreview = true;
break;
}
// Pre fill the contents of the popover
if ($showPreview) {
$cleanValue = MediaHelper::getCleanMediaFieldValue($value);
if ($cleanValue && file_exists(JPATH_ROOT . '/' . $cleanValue)) {
$src = Uri::root() . $value;
} else {
$src = '';
}
$width = $previewWidth;
$height = $previewHeight;
$style = '';
$style .= ($width > 0) ? 'max-width:' . $width . 'px;' : '';
$style .= ($height > 0) ? 'max-height:' . $height . 'px;' : '';
$imgattr = [
'id' => $id . '_preview',
'class' => 'media-preview',
'style' => $style,
];
$img = HTMLHelper::_('image', $src, Text::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgattr);
$previewImg = '<div id="' . $id . '_preview_img">' . $img . '</div>';
$previewImgEmpty = '<div id="' . $id . '_preview_empty"' . ($src ? ' class="hidden"' : '') . '>'
. Text::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>';
$showPreview = 'static';
}
// The url for the modal
$url = ($readonly ? ''
: ($link ?: 'index.php?option=com_media&view=media&tmpl=component&mediatypes=' . $mediaTypes
. '&asset=' . $asset . '&author=' . $authorId)
. '&fieldid={field-media-id}&path=' . $folder);
// Correctly route the url to ensure it's correctly using sef modes and subfolders
$url = Route::_($url);
$doc = Factory::getDocument();
$wam = $doc->getWebAssetManager();
$wam->useScript('webcomponent.media-select');
$doc->addScriptOptions('media-picker-api', ['apiBaseUrl' => Uri::base() . 'index.php?option=com_media&format=json']);
Text::script('JFIELD_MEDIA_LAZY_LABEL');
Text::script('JFIELD_MEDIA_ALT_LABEL');
Text::script('JFIELD_MEDIA_ALT_CHECK_LABEL');
Text::script('JFIELD_MEDIA_ALT_CHECK_DESC_LABEL');
Text::script('JFIELD_MEDIA_CLASS_LABEL');
Text::script('JFIELD_MEDIA_FIGURE_CLASS_LABEL');
Text::script('JFIELD_MEDIA_FIGURE_CAPTION_LABEL');
Text::script('JFIELD_MEDIA_LAZY_LABEL');
Text::script('JFIELD_MEDIA_SUMMARY_LABEL');
Text::script('JFIELD_MEDIA_EMBED_CHECK_DESC_LABEL');
Text::script('JFIELD_MEDIA_DOWNLOAD_CHECK_DESC_LABEL');
Text::script('JFIELD_MEDIA_DOWNLOAD_CHECK_LABEL');
Text::script('JFIELD_MEDIA_EMBED_CHECK_LABEL');
Text::script('JFIELD_MEDIA_WIDTH_LABEL');
Text::script('JFIELD_MEDIA_TITLE_LABEL');
Text::script('JFIELD_MEDIA_HEIGHT_LABEL');
Text::script('JFIELD_MEDIA_UNSUPPORTED');
Text::script('JFIELD_MEDIA_DOWNLOAD_FILE');
Text::script('JLIB_APPLICATION_ERROR_SERVER');
Text::script('JLIB_FORM_MEDIA_PREVIEW_EMPTY', true);
$modalHTML = HTMLHelper::_(
'bootstrap.renderModal',
'imageModal_' . $id,
[
'url' => $url,
'title' => Text::_('JLIB_FORM_CHANGE_IMAGE'),
'closeButton' => true,
'height' => '100%',
'width' => '100%',
'modalWidth' => '80',
'bodyHeight' => '60',
'footer' => '<button type="button" class="btn btn-success button-save-selected">' . Text::_('JSELECT') . '</button>'
. '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('JCANCEL') . '</button>',
]
);
$wam->useStyle('webcomponent.field-media')
->useScript('webcomponent.field-media');
if (count($doc->getScriptOptions('media-picker')) === 0) {
$doc->addScriptOptions('media-picker', [
'images' => $imagesExt,
'audios' => $audiosExt,
'videos' => $videosExt,
'documents' => $documentsExt,
]);
}
?>
<joomla-field-media class="field-media-wrapper" type="image" <?php // @TODO add this attribute to the field in order to use it for all media types ?>
base-path="<?php echo Uri::root(); ?>"
root-folder="<?php echo ComponentHelper::getParams('com_media')->get('file_path', 'images'); ?>"
url="<?php echo $url; ?>"
modal-container=".modal"
modal-width="100%"
modal-height="400px"
input=".field-media-input"
button-select=".button-select"
button-clear=".button-clear"
button-save-selected=".button-save-selected"
preview="static"
preview-container=".field-media-preview"
preview-width="<?php echo $previewWidth; ?>"
preview-height="<?php echo $previewHeight; ?>"
supported-extensions="<?php echo str_replace('"', '&quot;', json_encode(['images' => $imagesAllowedExt, 'audios' => $audiosAllowedExt, 'videos' => $videosAllowedExt, 'documents' => $documentsAllowedExt])); ?>
">
<?php echo $modalHTML; ?>
<?php if ($showPreview) : ?>
<div class="field-media-preview">
<?php echo ' ' . $previewImgEmpty; ?>
<?php echo ' ' . $previewImg; ?>
</div>
<?php endif; ?>
<div class="input-group">
<input type="text" name="<?php echo $name; ?>" id="<?php echo $id; ?>" value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>" <?php echo $attr; ?>>
<?php if ($disabled != true) : ?>
<button type="button" class="btn btn-success button-select"><?php echo Text::_('JLIB_FORM_BUTTON_SELECT'); ?></button>
<button type="button" class="btn btn-danger button-clear"><span class="icon-times" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('JLIB_FORM_BUTTON_CLEAR'); ?></span></button>
<?php endif; ?>
</div>
</joomla-field-media>

View File

@ -0,0 +1,24 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
$form = $forms[0];
$formfields = $form->getGroup('');
?>
<div class="subform-wrapper">
<?php foreach ($formfields as $field) : ?>
<?php echo $field->renderField(); ?>
<?php endforeach; ?>
</div>

View File

@ -0,0 +1,82 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $animated Is it animated.
* @var string $active Is it active.
* @var string $max The maximum value.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
*/
// Initialize some field attributes.
$class = 'progress-bar ' . $class;
$class .= $animated ? ' progress-bar-striped progress-bar-animated' : '';
$class .= $active ? ' active' : '';
$class = 'class="' . $class . '"';
$value = (float) $value;
$value = max($value, $min);
$value = min($value, $max);
$data = '';
$data .= 'aria-valuemax="' . $max . '"';
$data .= ' aria-valuemin="' . $min . '"';
$data .= ' aria-valuenow="' . $value . '"';
$attributes = [
$class,
!empty($width) ? ' style="width:' . $width . ';"' : '',
$data,
$dataAttribute,
];
$value = ((float) ($value - $min) * 100) / ($max - $min);
?>
<div class="progress">
<div
role="progressbar"
<?php echo implode(' ', $attributes); ?>
style="width:<?php echo (string) $value; ?>%;<?php echo !empty($color) ? ' background-color:' . $color . ';' : ''; ?>"></div>
</div>

View File

@ -0,0 +1,77 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2023 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
* @var string $valueTitle
* @var array $canDo
* @var string[] $urls
* @var string[] $modalTitles
* @var string[] $buttonIcons
*/
// Add the field script
if (!$readonly && !$disabled) {
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('modal-content-select-field');
}
$fieldClass = $required ? 'required modal-value' : '';
?>
<div class="js-modal-content-select-field <?php echo $class; ?>" <?php echo $dataAttribute; ?>>
<div class="input-group">
<input class="form-control js-input-title" type="text" value="<?php echo $this->escape($valueTitle ?? $value); ?>" readonly
id="<?php echo $id; ?>" name="<?php echo $name; ?>"
placeholder="<?php echo $this->escape($hint); ?>"/>
<?php if (!$readonly && !$disabled) :
echo $this->sublayout('buttons', $displayData);
// The "extra-buttons" layout allows to add extra control buttons to the field, example "propagate association" by com_content
echo $this->sublayout('extra-buttons', $displayData);
endif; ?>
</div>
<input type="hidden" id="<?php echo $id; ?>_id" class="<?php echo $fieldClass; ?> js-input-value" data-required="<?php echo (int) $required; ?>"
name="<?php echo $name; ?>" value="<?php echo $this->escape($value); ?>">
</div>

View File

@ -0,0 +1,103 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2023 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
* @var string $valueTitle
* @var array $canDo
* @var string[] $urls
* @var string[] $modalTitles
* @var string[] $buttonIcons
*/
// Prepare options for each Modal
$modalSelect = [
'popupType' => 'iframe',
'src' => $urls['select'] ?? '',
'textHeader' => $modalTitles['select'] ?? Text::_('JSELECT'),
];
$modalNew = [
'popupType' => 'iframe',
'src' => $urls['new'] ?? '',
'textHeader' => $modalTitles['new'] ?? Text::_('JACTION_CREATE'),
];
$modalEdit = [
'popupType' => 'iframe',
'src' => $urls['edit'] ?? '',
'textHeader' => $modalTitles['edit'] ?? Text::_('JACTION_EDIT'),
];
// Decide when the select button always will be visible
$isSelectAlways = !empty($canDo['select']) && empty($canDo['clear']);
?>
<?php if ($modalSelect['src'] && $canDo['select'] ?? true) : ?>
<button type="button" class="btn btn-primary" <?php echo $value && !$isSelectAlways ? 'hidden' : ''; ?>
data-button-action="select" <?php echo !$isSelectAlways ? 'data-show-when-value=""' : ''; ?>
data-modal-config="<?php echo $this->escape(json_encode($modalSelect)); ?>">
<span class="<?php echo !empty($buttonIcons['select']) ? $buttonIcons['select'] : 'icon-file'; ?>" aria-hidden="true"></span> <?php echo Text::_('JSELECT'); ?>
</button>
<?php endif; ?>
<?php if ($modalNew['src'] && $canDo['new'] ?? false) : ?>
<button type="button" class="btn btn-secondary" <?php echo $value ? 'hidden' : ''; ?>
data-button-action="create" data-show-when-value=""
data-modal-config="<?php echo $this->escape(json_encode($modalNew)); ?>">
<span class="icon-plus" aria-hidden="true"></span> <?php echo Text::_('JACTION_CREATE'); ?>
</button>
<?php endif; ?>
<?php if ($modalEdit['src'] && $canDo['edit'] ?? false) : ?>
<button type="button" class="btn btn-primary" <?php echo $value ? '' : 'hidden'; ?>
data-button-action="edit" data-show-when-value="1"
data-modal-config="<?php echo $this->escape(json_encode($modalEdit)); ?>"
data-checkin-url="<?php echo $this->escape($urls['checkin'] ?? ''); ?>">
<span class="icon-pen-square" aria-hidden="true"></span> <?php echo Text::_('JACTION_EDIT'); ?>
</button>
<?php endif; ?>
<?php if ($canDo['clear'] ?? true) : ?>
<button type="button" class="btn btn-secondary" <?php echo $value ? '' : 'hidden'; ?>
data-button-action="clear" data-show-when-value="1">
<span class="icon-times" aria-hidden="true"></span> <?php echo Text::_('JCLEAR'); ?>
</button>
<?php endif; ?>

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* The layout allows to add extra control buttons to the field, example "propagate association" by com_content.
*
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
* @var string $valueTitle
* @var array $canDo
* @var string[] $urls
* @var string[] $modalTitles
* @var string[] $buttonIcons
*/

View File

@ -0,0 +1,86 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
// Initialize some field attributes.
$attributes['dataid'] = 'data-id="' . $id . '"';
$attributes['data-url'] = 'data-url="index.php?option=com_modules&task=module.orderPosition&' . $token . '"';
$attributes['data-element'] = 'data-element="parent_' . $id . '"';
$attributes['data-ordering'] = 'data-ordering="' . $ordering . '"';
$attributes['data-position-element'] = 'data-position-element="' . $element . '"';
$attributes['data-client-id'] = 'data-client-id="' . $clientId . '"';
$attributes['data-name'] = 'data-name="' . $name . '"';
$attributes['data-module-id'] = 'data-module-id="' . $moduleId . '"';
if ($disabled) {
$attributes['disabled'] = 'disabled';
}
if ($class) {
$attributes['class'] = 'class="' . $class . '"';
}
if ($size) {
$attributes['size'] = 'size="' . $size . '"';
}
if ($onchange) {
$attributes['onchange'] = 'onchange="' . $onchange . '"';
}
if ($dataAttribute) {
$attributes['dataAttribute'] = $dataAttribute;
}
Factory::getDocument()->getWebAssetManager()
->useScript('webcomponent.field-module-order');
?>
<joomla-field-module-order <?php echo implode(' ', $attributes); ?>></joomla-field-module-order>

View File

@ -0,0 +1,78 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
$attributes = [
!empty($class) ? 'class="form-control ' . $class . '"' : 'class="form-control"',
!empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
!empty($onchange) ? 'onchange="' . $onchange . '"' : '',
isset($max) ? 'max="' . $max . '"' : '',
!empty($step) ? 'step="' . $step . '"' : '',
isset($min) ? 'min="' . $min . '"' : '',
$required ? 'required' : '',
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? 'autofocus' : '',
$dataAttribute,
];
if (is_numeric($value)) {
$value = (float) $value;
} else {
$value = '';
$value = ($required && isset($min)) ? $min : $value;
}
?>
<input
type="number"
inputmode="numeric"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo implode(' ', $attributes); ?>>

View File

@ -0,0 +1,158 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var boolean $rules Are the rules to be displayed?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
* @var boolean $lock Is this field locked.
*/
$document = Factory::getApplication()->getDocument();
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $document->getWebAssetManager();
if ($meter) {
$wa->useScript('field.passwordstrength');
$class = 'js-password-strength ' . $class;
if ($forcePassword) {
$class .= ' meteredPassword';
}
}
$wa->useScript('field.passwordview');
Text::script('JFIELD_PASSWORD_INDICATE_INCOMPLETE');
Text::script('JFIELD_PASSWORD_INDICATE_COMPLETE');
Text::script('JSHOWPASSWORD');
Text::script('JHIDEPASSWORD');
if ($lock) {
Text::script('JMODIFY');
Text::script('JCANCEL');
$disabled = true;
$hint = str_repeat('•', 10);
$value = '';
}
$ariaDescribedBy = $rules ? $name . '-rules ' : '';
$ariaDescribedBy .= !empty($description) ? (($id ?: $name) . '-desc') : '';
$attributes = [
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
!empty($class) ? 'class="form-control ' . $class . '"' : 'class="form-control"',
!empty($ariaDescribedBy) ? 'aria-describedby="' . trim($ariaDescribedBy) . '"' : '',
$readonly ? 'readonly' : '',
$disabled ? 'disabled' : '',
!empty($size) ? 'size="' . $size . '"' : '',
!empty($maxLength) ? 'maxlength="' . $maxLength . '"' : '',
$required ? 'required' : '',
$autofocus ? 'autofocus' : '',
!empty($minLength) ? 'data-min-length="' . $minLength . '"' : '',
!empty($minIntegers) ? 'data-min-integers="' . $minIntegers . '"' : '',
!empty($minSymbols) ? 'data-min-symbols="' . $minSymbols . '"' : '',
!empty($minUppercase) ? 'data-min-uppercase="' . $minUppercase . '"' : '',
!empty($minLowercase) ? 'data-min-lowercase="' . $minLowercase . '"' : '',
!empty($forcePassword) ? 'data-min-force="' . $forcePassword . '"' : '',
$dataAttribute,
];
if ($rules) {
$requirements = [];
if ($minLength) {
$requirements[] = Text::sprintf('JFIELD_PASSWORD_RULES_CHARACTERS', $minLength);
}
if ($minIntegers) {
$requirements[] = Text::sprintf('JFIELD_PASSWORD_RULES_DIGITS', $minIntegers);
}
if ($minSymbols) {
$requirements[] = Text::sprintf('JFIELD_PASSWORD_RULES_SYMBOLS', $minSymbols);
}
if ($minUppercase) {
$requirements[] = Text::sprintf('JFIELD_PASSWORD_RULES_UPPERCASE', $minUppercase);
}
if ($minLowercase) {
$requirements[] = Text::sprintf('JFIELD_PASSWORD_RULES_LOWERCASE', $minLowercase);
}
}
?>
<?php if ($rules) : ?>
<div id="<?php echo $name . '-rules'; ?>" class="small text-muted">
<?php echo Text::sprintf('JFIELD_PASSWORD_RULES_MINIMUM_REQUIREMENTS', implode(', ', $requirements)); ?>
</div>
<?php endif; ?>
<div class="password-group">
<div class="input-group">
<input
type="password"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo implode(' ', $attributes); ?>>
<?php if (!$lock) : ?>
<button type="button" class="btn btn-secondary input-password-toggle">
<span class="icon-eye icon-fw" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('JSHOWPASSWORD'); ?></span>
</button>
<?php else : ?>
<button type="button" id="<?php echo $id; ?>_lock" class="btn btn-info input-password-modify locked">
<?php echo Text::_('JMODIFY'); ?>
</button>
<?php endif; ?>
</div>
</div>

View File

@ -0,0 +1,127 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $options Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
$alt = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $name);
$isBtnGroup = strpos(trim($class), 'btn-group') !== false;
$isBtnYesNo = strpos(trim($class), 'btn-group-yesno') !== false;
$classToggle = $isBtnGroup ? 'btn-check' : 'form-check-input';
$btnClass = $isBtnGroup ? 'btn btn-outline-secondary' : 'form-check-label';
$blockStart = $isBtnGroup ? '' : '<div class="form-check">';
$blockEnd = $isBtnGroup ? '' : '</div>';
// Add the attributes of the fieldset in an array
$containerClass = trim($class . ' radio' . ($readonly || $disabled ? ' disabled' : '') . ($readonly ? ' readonly' : ''));
$attribs = ['id="' . $id . '"'];
if (!empty($disabled)) {
$attribs[] = 'disabled';
}
if (!empty($autofocus)) {
$attribs[] = 'autofocus';
}
if ($required) {
$attribs[] = 'class="required radio"';
}
if ($readonly || $disabled) {
$attribs[] = 'style="pointer-events: none"';
}
if ($dataAttribute) {
$attribs[] = $dataAttribute;
}
?>
<fieldset <?php echo implode(' ', $attribs); ?>>
<legend class="visually-hidden">
<?php echo $label; ?>
</legend>
<div class="<?php echo $containerClass; ?>">
<?php foreach ($options as $i => $option) : ?>
<?php echo $blockStart; ?>
<?php
$disabled = !empty($option->disable) ? 'disabled' : '';
$style = $disabled ? ' style="pointer-events: none"' : '';
// Initialize some option attributes.
if ($isBtnYesNo) {
// Set the button classes for the yes/no group
switch ($option->value) {
case '0':
$btnClass = 'btn btn-outline-danger';
break;
case '1':
$btnClass = 'btn btn-outline-success';
break;
default:
$btnClass = 'btn btn-outline-secondary';
break;
}
}
$optionClass = !empty($option->class) ? $option->class : $btnClass;
$optionClass = trim($optionClass . ' ' . $disabled);
$checked = ((string) $option->value === $value) ? 'checked="checked"' : '';
// Initialize some JavaScript option attributes.
$onclick = !empty($option->onclick) ? 'onclick="' . $option->onclick . '"' : '';
$onchange = !empty($option->onchange) ? 'onchange="' . $option->onchange . '"' : '';
$oid = $id . $i;
$ovalue = htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8');
$attributes = array_filter([$checked, $disabled, ltrim($style), $onchange, $onclick]);
?>
<?php if ($required) : ?>
<?php $attributes[] = 'required'; ?>
<?php endif; ?>
<input class="<?php echo $classToggle; ?>" type="radio" id="<?php echo $oid; ?>" name="<?php echo $name; ?>" value="<?php echo $ovalue; ?>" <?php echo implode(' ', $attributes); ?>>
<label for="<?php echo $oid; ?>" class="<?php echo trim($optionClass); ?>"<?php echo $style; ?>>
<?php echo $option->text; ?>
</label>
<?php echo $blockEnd; ?>
<?php endforeach; ?>
</div>
</fieldset>

View File

@ -0,0 +1,93 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2018 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $options Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
// If there are no options don't render anything
if (empty($options)) {
return '';
}
// Load the css files
Factory::getApplication()->getDocument()->getWebAssetManager()->useStyle('switcher');
/**
* The format of the input tag to be filled in using sprintf.
* %1 - id
* %2 - name
* %3 - value
* %4 = any other attributes
*/
$input = '<input type="radio" id="%1$s" name="%2$s" value="%3$s" %4$s>';
$attr = 'id="' . $id . '"';
$attr .= $onchange ? ' onchange="' . $onchange . '"' : '';
$attr .= $dataAttribute;
?>
<fieldset <?php echo $attr; ?>>
<legend class="visually-hidden">
<?php echo $label; ?>
</legend>
<div class="switcher<?php echo ($readonly || $disabled ? ' disabled' : ''); ?>">
<?php foreach ($options as $i => $option) : ?>
<?php
// False value casting as string returns an empty string so assign it 0
if (empty($value) && $option->value == '0') {
$value = '0';
}
// Initialize some option attributes.
$optionValue = (string) $option->value;
$optionId = $id . $i;
$attributes = $optionValue == $value ? 'checked class="active ' . $class . '"' : ($class ? 'class="' . $class . '"' : '');
$attributes .= $optionValue != $value && $readonly || $disabled ? ' disabled' : '';
?>
<?php echo sprintf($input, $optionId, $name, $this->escape($optionValue), $attributes); ?>
<?php echo '<label for="' . $optionId . '">' . $option->text . '</label>'; ?>
<?php endforeach; ?>
<span class="toggle-outside"><span class="toggle-inside"></span></span>
</div>
</fieldset>

View File

@ -0,0 +1,90 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $options Options available for this field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
/**
* The format of the input tag to be filled in using sprintf.
* %1 - id
* %2 - name
* %3 - value
* %4 = any other attributes
*/
$format = '<input type="radio" id="%1$s" name="%2$s" value="%3$s" %4$s>';
$alt = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $name);
?>
<fieldset id="<?php echo $id; ?>" class="<?php echo trim($class . ' radio'); ?>"
<?php echo $disabled ? 'disabled' : ''; ?>
<?php echo $required ? 'required' : ''; ?>
<?php echo $autofocus ? 'autofocus' : ''; ?>
<?php echo $dataAttribute; ?>>
<?php if (!empty($options)) : ?>
<?php foreach ($options as $i => $option) : ?>
<?php
// Initialize some option attributes.
$checked = ((string) $option->value === $value) ? 'checked="checked"' : '';
$optionClass = !empty($option->class) ? 'class="' . $option->class . '"' : '';
$disabled = !empty($option->disable) || ($disabled && !$checked) ? 'disabled' : '';
// Initialize some JavaScript option attributes.
$onclick = !empty($option->onclick) ? 'onclick="' . $option->onclick . '"' : '';
$onchange = !empty($option->onchange) ? 'onchange="' . $option->onchange . '"' : '';
$oid = $id . $i;
$ovalue = htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8');
$attributes = array_filter([$checked, $optionClass, $disabled, $onchange, $onclick]);
?>
<?php if ($required) : ?>
<?php $attributes[] = 'required'; ?>
<?php endif; ?>
<div class="radio mb-0">
<label for="<?php echo $oid; ?>" <?php echo $optionClass; ?>>
<?php echo sprintf($format, $oid, $name, $ovalue, implode(' ', $attributes)); ?>
<?php echo Text::alt($option->text, $alt); ?>
</label>
</div>
<?php endforeach; ?>
<?php endif; ?>
</fieldset>

View File

@ -0,0 +1,72 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
// Initialize some field attributes.
$attributes = [
$class ? 'class="form-range ' . $class . '"' : 'class="form-range"',
!empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
!empty($onchange) ? 'onchange="' . $onchange . '"' : '',
!empty($max) ? 'max="' . $max . '"' : '',
!empty($step) ? 'step="' . $step . '"' : '',
!empty($min) ? 'min="' . $min . '"' : '',
$autofocus ? 'autofocus' : '',
$dataAttribute,
];
$value = is_numeric($value) ? (float) $value : $min;
?>
<input
type="range"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo implode(' ', $attributes); ?>>

View File

@ -0,0 +1,234 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2018 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\Access\Access;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
extract($displayData);
// Get some system objects.
$document = Factory::getDocument();
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var array $options Options available for this field.
* @var array $groups Available user groups.
* @var array $actions Actions for the asset.
* @var integer $assetId Access parameters.
* @var string $component The component.
* @var string $section The section.
* @var boolean $isGlobalConfig Current view is global config?
* @var boolean $newItem The new item.
* @var object $assetRules Rules for asset.
* @var integer $parentAssetId To calculate permissions.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
// Add Javascript for permission change
HTMLHelper::_('form.csrf');
Factory::getDocument()->getWebAssetManager()
->useStyle('webcomponent.field-permissions')
->useScript('webcomponent.field-permissions')
->useStyle('webcomponent.joomla-tab')
->useScript('webcomponent.joomla-tab');
// Load JavaScript message titles
Text::script('ERROR');
Text::script('WARNING');
Text::script('NOTICE');
Text::script('MESSAGE');
// Add strings for JavaScript error translations.
Text::script('JLIB_JS_AJAX_ERROR_CONNECTION_ABORT');
Text::script('JLIB_JS_AJAX_ERROR_NO_CONTENT');
Text::script('JLIB_JS_AJAX_ERROR_OTHER');
Text::script('JLIB_JS_AJAX_ERROR_PARSE');
Text::script('JLIB_JS_AJAX_ERROR_TIMEOUT');
// Ajax request data.
$ajaxUri = Route::_('index.php?option=com_config&task=application.store&format=json&' . Session::getFormToken() . '=1');
?>
<?php // Description ?>
<details>
<summary class="rule-notes">
<?php echo Text::_('JLIB_RULES_SETTINGS_DESC'); ?>
</summary>
<div class="rule-notes">
<?php
if ($section === 'component' || !$section) {
echo Text::alt('JLIB_RULES_SETTING_NOTES', $component);
} else {
echo Text::alt('JLIB_RULES_SETTING_NOTES_ITEM', $component . '_' . $section);
}
?>
</div>
</details>
<?php // Begin tabs ?>
<joomla-field-permissions class="row mb-2" data-uri="<?php echo $ajaxUri; ?>" <?php echo $dataAttribute; ?>>
<joomla-tab orientation="vertical" id="permissions-sliders" recall breakpoint="728">
<?php // Initial Active Pane ?>
<?php foreach ($groups as $group) : ?>
<?php $active = (int) $group->value === 1 ? ' active' : ''; ?>
<joomla-tab-element class="tab-pane" <?php echo $active; ?> name="<?php echo htmlentities(LayoutHelper::render('joomla.html.treeprefix', ['level' => $group->level + 1]), ENT_COMPAT, 'utf-8') . $group->text; ?>" id="permission-<?php echo $group->value; ?>">
<table class="table respTable">
<thead>
<tr>
<th class="actions w-30" id="actions-th<?php echo $group->value; ?>">
<span class="acl-action"><?php echo Text::_('JLIB_RULES_ACTION'); ?></span>
</th>
<th class="settings w-40" id="settings-th<?php echo $group->value; ?>">
<span class="acl-action"><?php echo Text::_('JLIB_RULES_SELECT_SETTING'); ?></span>
</th>
<th class="w-30" id="aclaction-th<?php echo $group->value; ?>">
<span class="acl-action"><?php echo Text::_('JLIB_RULES_CALCULATED_SETTING'); ?></span>
</th>
</tr>
</thead>
<tbody>
<?php // Check if this group has super user permissions ?>
<?php $isSuperUserGroup = Access::checkGroup($group->value, 'core.admin'); ?>
<?php foreach ($actions as $action) : ?>
<tr>
<td class="oddCol" data-label="<?php echo Text::_('JLIB_RULES_ACTION'); ?>" headers="actions-th<?php echo $group->value; ?>">
<label for="<?php echo $id; ?>_<?php echo $action->name; ?>_<?php echo $group->value; ?>">
<?php echo Text::_($action->title); ?>
</label>
<?php if (!empty($action->description)) : ?>
<div role="tooltip" id="tip-<?php echo $id; ?>">
<?php echo htmlspecialchars(Text::_($action->description)); ?>
</div>
<?php endif; ?>
</td>
<td data-label="<?php echo Text::_('JLIB_RULES_SELECT_SETTING'); ?>" headers="settings-th<?php echo $group->value; ?>">
<div class="d-flex align-items-center">
<select data-onchange-task="permissions.apply"
class="form-select novalidate"
name="<?php echo $name; ?>[<?php echo $action->name; ?>][<?php echo $group->value; ?>]"
id="<?php echo $id; ?>_<?php echo $action->name; ?>_<?php echo $group->value; ?>" >
<?php
/**
* Possible values:
* null = not set means inherited
* false = denied
* true = allowed
*/
// Get the actual setting for the action for this group. ?>
<?php $assetRule = $newItem === false ? $assetRules->allow($action->name, $group->value) : null;?>
<?php // Build the dropdowns for the permissions sliders
// The parent group has "Not Set", all children can rightly "Inherit" from that.?>
<option value="" <?php echo ($assetRule === null ? ' selected="selected"' : ''); ?>>
<?php echo Text::_(empty($group->parent_id) && $isGlobalConfig ? 'JLIB_RULES_NOT_SET' : 'JLIB_RULES_INHERITED'); ?></option>
<option value="1" <?php echo ($assetRule === true ? ' selected="selected"' : ''); ?>>
<?php echo Text::_('JLIB_RULES_ALLOWED'); ?></option>
<option value="0" <?php echo ($assetRule === false ? ' selected="selected"' : ''); ?>>
<?php echo Text::_('JLIB_RULES_DENIED'); ?></option>
</select>&#160;
<span id="icon_<?php echo $id; ?>_<?php echo $action->name; ?>_<?php echo $group->value; ?>"></span>
</div>
</td>
<td data-label="<?php echo Text::_('JLIB_RULES_CALCULATED_SETTING'); ?>" headers="aclaction-th<?php echo $group->value; ?>">
<?php $result = []; ?>
<?php // Get the group, group parent id, and group global config recursive calculated permission for the chosen action. ?>
<?php $inheritedGroupRule = Access::checkGroup((int) $group->value, $action->name, $assetId);
$inheritedGroupParentAssetRule = !empty($parentAssetId) ? Access::checkGroup($group->value, $action->name, $parentAssetId) : null;
$inheritedParentGroupRule = !empty($group->parent_id) ? Access::checkGroup($group->parent_id, $action->name, $assetId) : null;
// Current group is a Super User group, so calculated setting is "Allowed (Super User)".
if ($isSuperUserGroup) {
$result['class'] = 'badge bg-success';
$result['text'] = '<span class="icon-lock icon-white" aria-hidden="true"></span>' . Text::_('JLIB_RULES_ALLOWED_ADMIN');
} else {
// First get the real recursive calculated setting and add (Inherited) to it.
// If recursive calculated setting is "Denied" or null. Calculated permission is "Not Allowed (Inherited)".
if ($inheritedGroupRule === null || $inheritedGroupRule === false) {
$result['class'] = 'badge bg-danger';
$result['text'] = Text::_('JLIB_RULES_NOT_ALLOWED_INHERITED');
} else {
// If recursive calculated setting is "Allowed". Calculated permission is "Allowed (Inherited)".
$result['class'] = 'badge bg-success';
$result['text'] = Text::_('JLIB_RULES_ALLOWED_INHERITED');
}
// Second part: Overwrite the calculated permissions labels if there is an explicit permission in the current group.
/**
* @todo: incorrect info
* If a component has a permission that doesn't exists in global config (ex: frontend editing in com_modules) by default
* we get "Not Allowed (Inherited)" when we should get "Not Allowed (Default)".
*/
// If there is an explicit permission "Not Allowed". Calculated permission is "Not Allowed".
if ($assetRule === false) {
$result['class'] = 'badge bg-danger';
$result['text'] = Text::_('JLIB_RULES_NOT_ALLOWED');
} elseif ($assetRule === true) {
// If there is an explicit permission is "Allowed". Calculated permission is "Allowed".
$result['class'] = 'badge bg-success';
$result['text'] = Text::_('JLIB_RULES_ALLOWED');
}
// Third part: Overwrite the calculated permissions labels for special cases.
// Global configuration with "Not Set" permission. Calculated permission is "Not Allowed (Default)".
if (empty($group->parent_id) && $isGlobalConfig === true && $assetRule === null) {
$result['class'] = 'badge bg-danger';
$result['text'] = Text::_('JLIB_RULES_NOT_ALLOWED_DEFAULT');
} elseif ($inheritedGroupParentAssetRule === false || $inheritedParentGroupRule === false) {
/**
* Component/Item with explicit "Denied" permission at parent Asset (Category, Component or Global config) configuration.
* Or some parent group has an explicit "Denied".
* Calculated permission is "Not Allowed (Locked)".
*/
$result['class'] = 'badge bg-danger';
$result['text'] = '<span class="icon-lock icon-white" aria-hidden="true"></span>' . Text::_('JLIB_RULES_NOT_ALLOWED_LOCKED');
}
}
?>
<output><span class="<?php echo $result['class']; ?>"><?php echo $result['text']; ?></span></output>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</joomla-tab-element>
<?php endforeach; ?>
</joomla-tab>
</joomla-field-permissions>

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\Form\Form;
extract($displayData);
/**
* Layout variables
* -----------------
* @var Form $tmpl The Empty form for template
* @var array $forms Array of JForm instances for render the rows
* @var bool $multiple The multiple state for the form field
* @var int $min Count of minimum repeating in multiple mode
* @var int $max Count of maximum repeating in multiple mode
* @var string $name Name of the input field.
* @var string $fieldname The field name
* @var string $fieldId The field ID
* @var string $control The forms control
* @var string $label The field label
* @var string $description The field description
* @var array $buttons Array of the buttons that will be rendered
* @var bool $groupByFieldset Whether group the subform fields by it`s fieldset
*/
$form = $forms[0];
?>
<div class="subform-wrapper">
<?php foreach ($form->getGroup('') as $field) : ?>
<?php echo $field->renderField(); ?>
<?php endforeach; ?>
</div>

View File

@ -0,0 +1,123 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\Form\Form;
use Joomla\CMS\Language\Text;
extract($displayData);
/**
* Layout variables
* -----------------
* @var Form $tmpl The Empty form for template
* @var array $forms Array of JForm instances for render the rows
* @var bool $multiple The multiple state for the form field
* @var int $min Count of minimum repeating in multiple mode
* @var int $max Count of maximum repeating in multiple mode
* @var string $name Name of the input field.
* @var string $fieldname The field name
* @var string $fieldId The field ID
* @var string $control The forms control
* @var string $label The field label
* @var string $description The field description
* @var string $class Classes for the container
* @var array $buttons Array of the buttons that will be rendered
* @var bool $groupByFieldset Whether group the subform fields by it`s fieldset
*/
if ($multiple) {
// Add script
Factory::getApplication()
->getDocument()
->getWebAssetManager()
->useScript('webcomponent.field-subform');
}
$class = $class ? ' ' . $class : '';
// Build heading
$table_head = '';
if (!empty($groupByFieldset)) {
foreach ($tmpl->getFieldsets() as $k => $fieldset) {
$table_head .= '<th scope="col">' . Text::_($fieldset->label);
if ($fieldset->description) {
$table_head .= '<span class="icon-info-circle" aria-hidden="true" tabindex="0"></span><div role="tooltip" id="tip-th-' . $fieldId . '-' . $k . '">' . Text::_($fieldset->description) . '</div>';
}
$table_head .= '</th>';
}
$sublayout = 'section-byfieldsets';
} else {
foreach ($tmpl->getGroup('') as $field) {
$table_head .= '<th scope="col" style="width:45%">' . strip_tags($field->label);
if ($field->description) {
$table_head .= '<span class="icon-info-circle" aria-hidden="true" tabindex="0"></span><div role="tooltip" id="tip-' . $field->id . '">' . Text::_($field->description) . '</div>';
}
$table_head .= '</th>';
}
$sublayout = 'section';
// Label will not be shown for sections layout, so reset the margin left
Factory::getApplication()
->getDocument()
->addStyleDeclaration('.subform-table-sublayout-section .controls { margin-left: 0px }');
}
?>
<div class="subform-repeatable-wrapper subform-table-layout subform-table-sublayout-<?php echo $sublayout; ?>">
<joomla-field-subform class="subform-repeatable<?php echo $class; ?>" name="<?php echo $name; ?>"
button-add=".group-add" button-remove=".group-remove" button-move="<?php echo empty($buttons['move']) ? '' : '.group-move' ?>"
repeatable-element=".subform-repeatable-group"
rows-container="tbody.subform-repeatable-container" minimum="<?php echo $min; ?>" maximum="<?php echo $max; ?>">
<div class="table-responsive">
<table class="table" id="subfieldList_<?php echo $fieldId; ?>">
<caption class="visually-hidden">
<?php echo Text::_('JGLOBAL_REPEATABLE_FIELDS_TABLE_CAPTION'); ?>
</caption>
<thead>
<tr>
<?php echo $table_head; ?>
<?php if (!empty($buttons)) : ?>
<td style="width:8%;">
<?php if (!empty($buttons['add'])) : ?>
<div class="btn-group">
<button type="button" class="group-add btn btn-sm btn-success" aria-label="<?php echo Text::_('JGLOBAL_FIELD_ADD'); ?>">
<span class="icon-plus" aria-hidden="true"></span>
</button>
</div>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
</thead>
<tbody class="subform-repeatable-container">
<?php
foreach ($forms as $k => $form) :
echo $this->sublayout($sublayout, ['form' => $form, 'basegroup' => $fieldname, 'group' => $fieldname . $k, 'buttons' => $buttons]);
endforeach;
?>
</tbody>
</table>
</div>
<?php if ($multiple) : ?>
<template class="subform-repeatable-template-section hidden">
<?php echo trim($this->sublayout($sublayout, ['form' => $tmpl, 'basegroup' => $fieldname, 'group' => $fieldname . 'X', 'buttons' => $buttons])); ?>
</template>
<?php endif; ?>
</joomla-field-subform>
</div>

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\Form\Form;
use Joomla\CMS\Language\Text;
extract($displayData);
/**
* Layout variables
* -----------------
* @var Form $form The form instance for render the section
* @var string $basegroup The base group name
* @var string $group Current group name
* @var array $buttons Array of the buttons that will be rendered
*/
?>
<tr class="subform-repeatable-group" data-base-name="<?php echo $basegroup; ?>" data-group="<?php echo $group; ?>">
<?php foreach ($form->getFieldsets() as $fieldset) : ?>
<td class="<?php if (!empty($fieldset->class)) {
echo $fieldset->class;
} ?>">
<?php foreach ($form->getFieldset($fieldset->name) as $field) : ?>
<?php echo $field->renderField(); ?>
<?php endforeach; ?>
</td>
<?php endforeach; ?>
<?php if (!empty($buttons)) : ?>
<td>
<div class="btn-group">
<?php if (!empty($buttons['add'])) : ?>
<button type="button" class="group-add btn btn-sm btn-success" aria-label="<?php echo Text::_('JGLOBAL_FIELD_ADD'); ?>">
<span class="icon-plus" aria-hidden="true"></span>
</button>
<?php endif; ?>
<?php if (!empty($buttons['remove'])) : ?>
<button type="button" class="group-remove btn btn-sm btn-danger" aria-label="<?php echo Text::_('JGLOBAL_FIELD_REMOVE'); ?>">
<span class="icon-minus" aria-hidden="true"></span>
</button>
<?php endif; ?>
<?php if (!empty($buttons['move'])) : ?>
<button type="button" class="group-move btn btn-sm btn-primary" aria-label="<?php echo Text::_('JGLOBAL_FIELD_MOVE'); ?>">
<span class="icon-arrows-alt" aria-hidden="true"></span>
</button>
<?php endif; ?>
</div>
</td>
<?php endif; ?>
</tr>

View File

@ -0,0 +1,55 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\Form\Form;
use Joomla\CMS\Language\Text;
extract($displayData);
/**
* Layout variables
* -----------------
* @var Form $form The form instance for render the section
* @var string $basegroup The base group name
* @var string $group Current group name
* @var array $buttons Array of the buttons that will be rendered
*/
?>
<tr class="subform-repeatable-group" data-base-name="<?php echo $basegroup; ?>" data-group="<?php echo $group; ?>">
<?php foreach ($form->getGroup('') as $field) : ?>
<td data-column="<?php echo strip_tags($field->label); ?>">
<?php echo $field->renderField(['hiddenLabel' => true, 'hiddenDescription' => true]); ?>
</td>
<?php endforeach; ?>
<?php if (!empty($buttons)) : ?>
<td>
<div class="btn-group">
<?php if (!empty($buttons['add'])) : ?>
<button type="button" class="group-add btn btn-sm btn-success" aria-label="<?php echo Text::_('JGLOBAL_FIELD_ADD'); ?>">
<span class="icon-plus" aria-hidden="true"></span>
</button>
<?php endif; ?>
<?php if (!empty($buttons['remove'])) : ?>
<button type="button" class="group-remove btn btn-sm btn-danger" aria-label="<?php echo Text::_('JGLOBAL_FIELD_REMOVE'); ?>">
<span class="icon-minus" aria-hidden="true"></span>
</button>
<?php endif; ?>
<?php if (!empty($buttons['move'])) : ?>
<button type="button" class="group-move btn btn-sm btn-primary" aria-label="<?php echo Text::_('JGLOBAL_FIELD_MOVE'); ?>">
<span class="icon-arrows-alt" aria-hidden="true"></span>
</button>
<?php endif; ?>
</div>
</td>
<?php endif; ?>
</tr>

View File

@ -0,0 +1,74 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\Form\Form;
use Joomla\CMS\Language\Text;
extract($displayData);
/**
* Layout variables
* -----------------
* @var Form $tmpl The Empty form for template
* @var array $forms Array of JForm instances for render the rows
* @var bool $multiple The multiple state for the form field
* @var int $min Count of minimum repeating in multiple mode
* @var int $max Count of maximum repeating in multiple mode
* @var string $name Name of the input field.
* @var string $fieldname The field name
* @var string $fieldId The field ID
* @var string $control The forms control
* @var string $label The field label
* @var string $description The field description
* @var string $class Classes for the container
* @var array $buttons Array of the buttons that will be rendered
* @var bool $groupByFieldset Whether group the subform fields by it`s fieldset
*/
if ($multiple) {
// Add script
Factory::getApplication()
->getDocument()
->getWebAssetManager()
->useScript('webcomponent.field-subform');
}
$class = $class ? ' ' . $class : '';
$sublayout = empty($groupByFieldset) ? 'section' : 'section-byfieldsets';
?>
<div class="subform-repeatable-wrapper subform-layout">
<joomla-field-subform class="subform-repeatable<?php echo $class; ?>" name="<?php echo $name; ?>"
button-add=".group-add" button-remove=".group-remove" button-move="<?php echo empty($buttons['move']) ? '' : '.group-move' ?>"
repeatable-element=".subform-repeatable-group" minimum="<?php echo $min; ?>" maximum="<?php echo $max; ?>">
<?php if (!empty($buttons['add'])) : ?>
<div class="btn-toolbar">
<div class="btn-group">
<button type="button" class="group-add btn btn-sm button btn-success" aria-label="<?php echo Text::_('JGLOBAL_FIELD_ADD'); ?>">
<span class="icon-plus icon-white" aria-hidden="true"></span>
</button>
</div>
</div>
<?php endif; ?>
<?php
foreach ($forms as $k => $form) :
echo $this->sublayout($sublayout, ['form' => $form, 'basegroup' => $fieldname, 'group' => $fieldname . $k, 'buttons' => $buttons]);
endforeach;
?>
<?php if ($multiple) : ?>
<template class="subform-repeatable-template-section hidden"><?php
echo trim($this->sublayout($sublayout, ['form' => $tmpl, 'basegroup' => $fieldname, 'group' => $fieldname . 'X', 'buttons' => $buttons]));
?></template>
<?php endif; ?>
</joomla-field-subform>
</div>

View File

@ -0,0 +1,58 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\Form\Form;
use Joomla\CMS\Language\Text;
extract($displayData);
/**
* Layout variables
* -----------------
* @var Form $form The form instance for render the section
* @var string $basegroup The base group name
* @var string $group Current group name
* @var array $buttons Array of the buttons that will be rendered
*/
?>
<div class="subform-repeatable-group" data-base-name="<?php echo $basegroup; ?>" data-group="<?php echo $group; ?>">
<?php if (!empty($buttons)) : ?>
<div class="btn-toolbar text-end">
<div class="btn-group">
<?php if (!empty($buttons['add'])) :
?><button type="button" class="group-add btn btn-sm btn-success" aria-label="<?php echo Text::_('JGLOBAL_FIELD_ADD'); ?>"><span class="icon-plus icon-white" aria-hidden="true"></span> </button><?php
endif; ?>
<?php if (!empty($buttons['remove'])) :
?><button type="button" class="group-remove btn btn-sm btn-danger" aria-label="<?php echo Text::_('JGLOBAL_FIELD_REMOVE'); ?>"><span class="icon-minus icon-white" aria-hidden="true"></span> </button><?php
endif; ?>
<?php if (!empty($buttons['move'])) :
?><button type="button" class="group-move btn btn-sm btn-primary" aria-label="<?php echo Text::_('JGLOBAL_FIELD_MOVE'); ?>"><span class="icon-arrows-alt icon-white" aria-hidden="true"></span> </button><?php
endif; ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<?php foreach ($form->getFieldsets() as $fieldset) : ?>
<fieldset class="<?php if (!empty($fieldset->class)) {
echo $fieldset->class;
} ?>">
<?php if (!empty($fieldset->label)) : ?>
<legend><?php echo Text::_($fieldset->label); ?></legend>
<?php endif; ?>
<?php foreach ($form->getFieldset($fieldset->name) as $field) : ?>
<?php echo $field->renderField(); ?>
<?php endforeach; ?>
</fieldset>
<?php endforeach; ?>
</div>
</div>

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\Form\Form;
use Joomla\CMS\Language\Text;
extract($displayData);
/**
* Layout variables
* -----------------
* @var Form $form The form instance for render the section
* @var string $basegroup The base group name
* @var string $group Current group name
* @var array $buttons Array of the buttons that will be rendered
*/
?>
<div class="subform-repeatable-group" data-base-name="<?php echo $basegroup; ?>" data-group="<?php echo $group; ?>">
<?php if (!empty($buttons)) : ?>
<div class="btn-toolbar text-end">
<div class="btn-group">
<?php if (!empty($buttons['add'])) :
?><button type="button" class="group-add btn btn-sm btn-success" aria-label="<?php echo Text::_('JGLOBAL_FIELD_ADD'); ?>"><span class="icon-plus icon-white" aria-hidden="true"></span> </button><?php
endif; ?>
<?php if (!empty($buttons['remove'])) :
?><button type="button" class="group-remove btn btn-sm btn-danger" aria-label="<?php echo Text::_('JGLOBAL_FIELD_REMOVE'); ?>"><span class="icon-minus icon-white" aria-hidden="true"></span> </button><?php
endif; ?>
<?php if (!empty($buttons['move'])) :
?><button type="button" class="group-move btn btn-sm btn-primary" aria-label="<?php echo Text::_('JGLOBAL_FIELD_MOVE'); ?>"><span class="icon-arrows-alt icon-white" aria-hidden="true"></span> </button><?php
endif; ?>
</div>
</div>
<?php endif; ?>
<?php foreach ($form->getGroup('') as $field) : ?>
<?php echo $field->renderField(); ?>
<?php endforeach; ?>
</div>

View File

@ -0,0 +1,123 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2018 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\Uri\Uri;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var boolean $allowCustom Flag, to allow add custom values
* @var boolean $remoteSearch Flag, to enable remote search
* @var integer $minTermLength Minimum length of the term to start searching
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attributes for eg, data-*.
*/
$html = [];
$attr = '';
// Initialize some field attributes.
$attr .= $multiple ? ' multiple' : '';
$attr .= $autofocus ? ' autofocus' : '';
$attr .= $onchange ? ' onchange="' . $onchange . '"' : '';
$attr .= $dataAttribute;
// To avoid user's confusion, readonly="readonly" should imply disabled="disabled".
if ($readonly || $disabled) {
$attr .= ' disabled="disabled"';
}
$attr2 = '';
$attr2 .= !empty($class) ? ' class="' . $class . '"' : '';
$attr2 .= ' placeholder="' . $this->escape($hint ?: Text::_('JGLOBAL_TYPE_OR_SELECT_SOME_TAGS')) . '" ';
$attr2 .= $dataAttribute;
if ($allowCustom) {
$attr2 .= $allowCustom ? ' allow-custom' : '';
$attr2 .= $allowCustom ? ' new-item-prefix="#new#"' : '';
}
if ($remoteSearch) {
$attr2 .= ' remote-search';
$attr2 .= ' url="' . Uri::root(true) . '/index.php?option=com_tags&task=tags.searchAjax"';
$attr2 .= ' term-key="like"';
$attr2 .= ' min-term-length="' . $minTermLength . '"';
}
if ($required) {
$attr .= ' required class="required"';
$attr2 .= ' required';
}
// Create a read-only list (no name) with hidden input(s) to store the value(s).
if ($readonly) {
$html[] = HTMLHelper::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $value, $id);
// E.g. form field type tag sends $this->value as array
if ($multiple && is_array($value)) {
if (!count($value)) {
$value[] = '';
}
foreach ($value as $val) {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">';
}
} else {
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">';
}
} else // Create a regular list.
{
$html[] = HTMLHelper::_('select.genericlist', $options, $name, trim($attr), 'value', 'text', $value, $id);
}
Text::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
Text::script('JGLOBAL_SELECT_PRESS_TO_SELECT');
Factory::getDocument()->getWebAssetManager()
->usePreset('choicesjs')
->useScript('webcomponent.field-fancy-select');
?>
<joomla-field-fancy-select <?php echo $attr2; ?>><?php echo implode($html); ?></joomla-field-fancy-select>

View File

@ -0,0 +1,74 @@
<?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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var integer $maxLength The maximum length that the field shall accept.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
$attributes = [
!empty($size) ? 'size="' . $size . '"' : '',
!empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? 'autofocus' : '',
$spellcheck ? '' : 'spellcheck="false"',
$onchange ? 'onchange="' . $onchange . '"' : '',
!empty($maxLength) ? $maxLength : '',
$required ? 'required' : '',
!empty($pattern) ? 'pattern="' . $pattern . '"' : '',
$dataAttribute,
];
?>
<input
type="tel"
inputmode="tel"
name="<?php echo $name; ?>"
<?php echo !empty($class) ? ' class="form-control ' . $class . '"' : 'class="form-control"'; ?>
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo implode(' ', $attributes); ?>>

View File

@ -0,0 +1,138 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
* @var string $dirname The directory name
* @var string $addonBefore The text to use in a bootstrap input group prepend
* @var string $addonAfter The text to use in a bootstrap input group append
* @var boolean $charcounter Does this field support a character counter?
*/
$list = '';
if ($options) {
$list = 'list="' . $id . '_datalist"';
}
$charcounterclass = '';
if ($charcounter) {
// Load the js file
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('short-and-sweet');
// Set the css class to be used as the trigger
$charcounterclass = ' charcount';
// Set the text
$counterlabel = 'data-counter-label="' . $this->escape(Text::_('JFIELD_META_DESCRIPTION_COUNTER')) . '"';
}
$attributes = [
!empty($class) ? 'class="form-control ' . $class . $charcounterclass . '"' : 'class="form-control' . $charcounterclass . '"',
!empty($size) ? 'size="' . $size . '"' : '',
!empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
$dataAttribute,
$list,
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
$onchange ? ' onchange="' . $onchange . '"' : '',
!empty($maxLength) ? $maxLength : '',
$required ? 'required' : '',
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? ' autofocus' : '',
$spellcheck ? '' : 'spellcheck="false"',
!empty($inputmode) ? $inputmode : '',
!empty($counterlabel) ? $counterlabel : '',
!empty($pattern) ? 'pattern="' . $pattern . '"' : '',
// @TODO add a proper string here!!!
!empty($validationtext) ? 'data-validation-text="' . $validationtext . '"' : '',
];
$addonBeforeHtml = '<span class="input-group-text">' . Text::_($addonBefore) . '</span>';
$addonAfterHtml = '<span class="input-group-text">' . Text::_($addonAfter) . '</span>';
?>
<?php if (!empty($addonBefore) || !empty($addonAfter)) : ?>
<div class="input-group">
<?php endif; ?>
<?php if (!empty($addonBefore)) : ?>
<?php echo $addonBeforeHtml; ?>
<?php endif; ?>
<input
type="text"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo $dirname; ?>
<?php echo implode(' ', $attributes); ?>>
<?php if (!empty($addonAfter)) : ?>
<?php echo $addonAfterHtml; ?>
<?php endif; ?>
<?php if (!empty($addonBefore) || !empty($addonAfter)) : ?>
</div>
<?php endif; ?>
<?php if ($options) : ?>
<datalist id="<?php echo $id; ?>_datalist">
<?php foreach ($options as $option) : ?>
<?php if (!$option->value) : ?>
<?php continue; ?>
<?php endif; ?>
<option value="<?php echo $option->value; ?>"><?php echo $option->text; ?></option>
<?php endforeach; ?>
</datalist>
<?php endif; ?>

View File

@ -0,0 +1,89 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var boolean $charcounter Does this field support a character counter?
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
// Initialize some field attributes.
if ($charcounter) {
// Load the js file
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('short-and-sweet');
// Set the css class to be used as the trigger
$charcounter = ' charcount';
// Set the text
$counterlabel = 'data-counter-label="' . $this->escape(Text::_('JFIELD_META_DESCRIPTION_COUNTER')) . '"';
}
$attributes = [
$columns ?: '',
$rows ?: '',
!empty($class) ? 'class="form-control ' . $class . $charcounter . '"' : 'class="form-control' . $charcounter . '"',
!empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
$onchange ? 'onchange="' . $onchange . '"' : '',
$onclick ? 'onclick="' . $onclick . '"' : '',
$required ? 'required' : '',
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? 'autofocus' : '',
$spellcheck ? '' : 'spellcheck="false"',
$maxlength ?: '',
!empty($counterlabel) ? $counterlabel : '',
$dataAttribute,
];
?>
<textarea name="<?php
echo $name; ?>" id="<?php
echo $id; ?>" <?php
echo implode(' ', $attributes); ?> ><?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?></textarea>

View File

@ -0,0 +1,73 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* @var array $displayData Array with values.
*/
extract($displayData);
/**
* Layout variables
* -----------------
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
$attributes = [
!empty($class) ? 'class="form-control ' . $class . '"' : 'class="form-control"',
!empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
!empty($onchange) ? 'onchange="' . $onchange . '"' : '',
isset($max) ? 'max="' . $max . '"' : '',
isset($step) ? 'step="' . $step . '"' : '',
isset($min) ? 'min="' . $min . '"' : '',
$required ? 'required' : '',
$autofocus ? 'autofocus' : '',
$dataAttribute,
];
?>
<input
type="time"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo $value ?>"
<?php echo implode(' ', $attributes); ?>>

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2016 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\String\PunycodeHelper;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
$attributes = [
!empty($size) ? ' size="' . $size . '"' : '',
!empty($description) ? ' aria-describedby="' . ($id ?: $name) . '-desc"' : '',
$disabled ? ' disabled' : '',
$readonly ? ' readonly' : '',
strlen($hint) ? ' placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? ' autofocus' : '',
$spellcheck ? '' : ' spellcheck="false"',
$onchange ? ' onchange="' . $onchange . '"' : '',
!empty($maxLength) ? $maxLength : '',
$required ? ' required' : '',
$dataAttribute,
];
/**
* @deprecated 4.3 will be removed in 6.0
* The unicode conversion of the URL will be moved to \Joomla\CMS\Form\Field\UrlField::getLayoutData
*/
if ($value !== null) {
$value = $this->escape(PunycodeHelper::urlToUTF8($value));
}
?>
<input <?php echo $inputType; ?> inputmode="url" name="<?php echo $name; ?>" <?php echo !empty($class) ? ' class="form-control ' . $class . '"' : 'class="form-control"'; ?> id="<?php echo $id; ?>" value="<?php echo $value; ?>" <?php echo implode(' ', $attributes); ?>>

View File

@ -0,0 +1,120 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 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;
use Joomla\CMS\Uri\Uri;
use Joomla\Utilities\ArrayHelper;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var string $userName The user name
* @var mixed $groups The filtering groups (null means no filtering)
* @var mixed $excluded The users to exclude from the list of users
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*.
*/
$uri = new Uri('index.php?option=com_users&view=users&layout=modal&tmpl=component&required=0');
$uri->setVar('field', $this->escape($id));
if ($required) {
$uri->setVar('required', 1);
}
if (!empty($groups)) {
$uri->setVar('groups', base64_encode(json_encode($groups)));
}
if (!empty($excluded)) {
$uri->setVar('excluded', base64_encode(json_encode($excluded)));
}
// Invalidate the input value if no user selected
if ($this->escape($userName) === Text::_('JLIB_FORM_SELECT_USER')) {
$userName = '';
}
$inputAttributes = [
'type' => 'text',
'id' => $id,
'class' => 'form-control field-user-input-name',
'value' => $this->escape($userName),
];
if ($class) {
$inputAttributes['class'] .= ' ' . $class;
}
if ($size) {
$inputAttributes['size'] = (int) $size;
}
if ($required) {
$inputAttributes['required'] = 'required';
}
if (!$readonly) {
$inputAttributes['placeholder'] = Text::_('JLIB_FORM_SELECT_USER');
}
if (!$readonly) {
Factory::getApplication()->getDocument()->getWebAssetManager()
->useScript('webcomponent.field-user');
}
?>
<?php // Create a dummy text field with the user name. ?>
<joomla-field-user class="field-user-wrapper"
url="<?php echo (string) $uri; ?>"
modal-title="<?php echo $this->escape(Text::_('JLIB_FORM_CHANGE_USER')); ?>"
input=".field-user-input"
input-name=".field-user-input-name"
button-select=".button-select">
<div class="input-group">
<input <?php echo ArrayHelper::toString($inputAttributes), $dataAttribute; ?> readonly>
<?php if (!$readonly) : ?>
<button type="button" class="btn btn-primary button-select" title="<?php echo Text::_('JLIB_FORM_CHANGE_USER'); ?>">
<span class="icon-user icon-white" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('JLIB_FORM_CHANGE_USER'); ?></span>
</button>
<?php endif; ?>
</div>
<?php // Create the real field, hidden, that stored the user id. ?>
<?php if (!$readonly) : ?>
<input type="hidden" id="<?php echo $id; ?>_id" name="<?php echo $name; ?>" value="<?php echo $this->escape($value); ?>"
class="field-user-input <?php echo $class ? (string) $class : ''?>"
data-onchange="<?php echo $this->escape($onchange); ?>">
<?php endif; ?>
</joomla-field-user>

View File

@ -0,0 +1,63 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2014 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var array $options Optional parameters
* @var string $id The id of the input this label is for
* @var string $name The name of the input this label is for
* @var string $label The html code for the label
* @var string $input The input field html code
* @var string $description An optional description to use as inline help text
* @var string $descClass The class name to use for the description
*/
if (!empty($options['showonEnabled'])) {
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('showon');
}
$class = empty($options['class']) ? '' : ' ' . $options['class'];
$rel = empty($options['rel']) ? '' : ' ' . $options['rel'];
$id = ($id ?? $name) . '-desc';
$hideLabel = !empty($options['hiddenLabel']);
$hideDescription = empty($options['hiddenDescription']) ? false : $options['hiddenDescription'];
$descClass = ($options['descClass'] ?? '') ?: (!empty($options['inlineHelp']) ? 'hide-aware-inline-help d-none' : '');
if (!empty($parentclass)) {
$class .= ' ' . $parentclass;
}
?>
<div class="control-group<?php echo $class; ?>"<?php echo $rel; ?>>
<?php if ($hideLabel) : ?>
<div class="visually-hidden"><?php echo $label; ?></div>
<?php else : ?>
<div class="control-label"><?php echo $label; ?></div>
<?php endif; ?>
<div class="controls">
<?php echo $input; ?>
<?php if (!$hideDescription && !empty($description)) : ?>
<div id="<?php echo $id; ?>" class="<?php echo $descClass ?>">
<small class="form-text">
<?php echo $description; ?>
</small>
</div>
<?php endif; ?>
</div>
</div>

View File

@ -0,0 +1,38 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2014 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $text The label text
* @var string $for The id of the input this label is for
* @var boolean $required True if a required field
* @var array $classes A list of classes
*/
$classes = array_filter((array) $classes);
$id = $for . '-lbl';
if ($required) {
$classes[] = 'required';
}
?>
<label id="<?php echo $id; ?>" for="<?php echo $for; ?>"<?php if (!empty($classes)) {
echo ' class="' . implode(' ', $classes) . '"';
} ?>>
<?php echo $text; ?><?php if ($required) :
?><span class="star" aria-hidden="true">&#160;*</span><?php
endif; ?>
</label>

View File

@ -0,0 +1,29 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<label id="batch-access-lbl" for="batch-access">
<?php echo Text::_('JLIB_HTML_BATCH_ACCESS_LABEL'); ?>
</label>
<?php echo HTMLHelper::_(
'access.assetgrouplist',
'batch[assetgroup_id]',
'',
'class="form-select"',
[
'title' => Text::_('JLIB_HTML_BATCH_NOCHANGE'),
'id' => 'batch-access'
]
);

View File

@ -0,0 +1,23 @@
<?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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<label id="batch-language-lbl" for="batch-language-id">
<?php echo Text::_('JLIB_HTML_BATCH_LANGUAGE_LABEL'); ?>
</label>
<select name="batch[language_id]" class="form-select" id="batch-language-id">
<option value=""><?php echo Text::_('JLIB_HTML_BATCH_LANGUAGE_NOCHANGE'); ?></option>
<?php echo HTMLHelper::_('select.options', HTMLHelper::_('adminlanguage.existing', true, true), 'value', 'text'); ?>
</select>

View File

@ -0,0 +1,56 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $extension The extension name
*/
// Create the copy/move options.
$options = [
HTMLHelper::_('select.option', 'c', Text::_('JLIB_HTML_BATCH_COPY')),
HTMLHelper::_('select.option', 'm', Text::_('JLIB_HTML_BATCH_MOVE'))
];
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('joomla.batch-copymove');
?>
<label id="batch-choose-action-lbl" for="batch-category-id">
<?php echo Text::_('JLIB_HTML_BATCH_MENU_LABEL'); ?>
</label>
<div id="batch-choose-action" class="control-group">
<select name="batch[category_id]" class="form-select" id="batch-category-id">
<option value=""><?php echo Text::_('JLIB_HTML_BATCH_NO_CATEGORY'); ?></option>
<?php if (isset($addRoot) && $addRoot) : ?>
<?php echo HTMLHelper::_('select.options', HTMLHelper::_('category.categories', $extension)); ?>
<?php else : ?>
<?php echo HTMLHelper::_('select.options', HTMLHelper::_('category.options', $extension)); ?>
<?php endif; ?>
</select>
</div>
<div id="batch-copy-move" class="control-group radio">
<fieldset id="batch-copy-move-id">
<legend>
<?php echo Text::_('JLIB_HTML_BATCH_MOVE_QUESTION'); ?>
</legend>
<?php echo HTMLHelper::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'); ?>
</fieldset>
</div>

View File

@ -0,0 +1,23 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<label id="batch-language-lbl" for="batch-language-id">
<?php echo Text::_('JLIB_HTML_BATCH_LANGUAGE_LABEL'); ?>
</label>
<select name="batch[language_id]" class="form-select" id="batch-language-id">
<option value=""><?php echo Text::_('JLIB_HTML_BATCH_LANGUAGE_NOCHANGE'); ?></option>
<?php echo HTMLHelper::_('select.options', HTMLHelper::_('contentlanguage.existing', true, true), 'value', 'text'); ?>
</select>

View File

@ -0,0 +1,23 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<label id="batch-tag-lbl" for="batch-tag-id">
<?php echo Text::_('JLIB_HTML_BATCH_TAG_LABEL'); ?>
</label>
<select name="batch[tag]" class="form-select" id="batch-tag-id">
<option value=""><?php echo Text::_('JLIB_HTML_BATCH_TAG_NOCHANGE'); ?></option>
<?php echo HTMLHelper::_('select.options', HTMLHelper::_('tag.tags', ['filter.published' => [1]]), 'value', 'text'); ?>
</select>

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
extract($displayData);
/**
* Layout variables
* -----------------
* @var boolean $noUser Inject an option for no user?
*/
$optionNo = '';
if ($noUser) {
$optionNo = '<option value="0">' . Text::_('JLIB_HTML_BATCH_USER_NOUSER') . '</option>';
}
?>
<label id="batch-user-lbl" for="batch-user-id">
<?php echo Text::_('JLIB_HTML_BATCH_USER_LABEL'); ?>
</label>
<select name="batch[user_id]" class="form-select" id="batch-user-id">
<option value=""><?php echo Text::_('JLIB_HTML_BATCH_USER_NOCHANGE'); ?></option>
<?php echo $optionNo; ?>
<?php echo HTMLHelper::_('select.options', HTMLHelper::_('user.userlist'), 'value', 'text'); ?>
</select>

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2018 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
?>
<label id="batch-workflowstage-lbl" for="batch-workflowstage-id">
<?php echo Text::_('JLIB_HTML_BATCH_WORKFLOW_STAGE_LABEL'); ?>
</label>
<?php
$attr = [
'id' => 'batch-workflowstage-id',
'group.label' => 'text',
'group.items' => null,
'list.attr' => [
'class' => 'form-select'
]
];
$groups = HTMLHelper::_('workflowstage.existing', ['title' => Text::_('JLIB_HTML_BATCH_WORKFLOW_STAGE_NOCHANGE')]);
echo HTMLHelper::_('select.groupedlist', $groups, 'batch[workflowstage_id]', $attr);

Some files were not shown because too many files have changed in this diff Show More