first commit
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
;; @package Tabs & Accordions
|
||||
;; @version 2.0.0
|
||||
;;
|
||||
;; @author Peter van Westen <info@regularlabs.com>
|
||||
;; @link https://regularlabs.com
|
||||
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
;; @license GNU General Public License version 2 or later
|
||||
;;
|
||||
;; @translate Want to help with translations? See: https://regularlabs.com/translate
|
||||
|
||||
PLG_SYSTEM_TABSACCORDIONS="System - Regular Labs - Tabs & Accordions"
|
||||
PLG_SYSTEM_TABSACCORDIONS_DESC="Tabs & Accordions - make content tabs and accordions in Joomla!"
|
||||
TABSACCORDIONS="Tabs & Accordions"
|
||||
|
||||
INSERT_TABS="Insert Tabs"
|
||||
INSERT_ACCORDIONS="Insert Accordions"
|
||||
TABSACCORDIONS_DESC="With Tabs & Accordions you can make content tabs and accordions anywhere in Joomla!"
|
||||
|
||||
RLTA_EXTENSION_CAN_NOT_FUNCTION="[[%1:extension name%]] cannot function."
|
||||
RLTA_REGULAR_LABS_LIBRARY_NOT_ENABLED="Regular Labs Library plugin is not enabled."
|
||||
RLTA_REGULAR_LABS_LIBRARY_NOT_INSTALLED="Regular Labs Library plugin is not installed."
|
||||
RLTA_REGULAR_LABS_LIBRARY_OUTDATED="Regular Labs Library plugin is outdated. Try to re-install [[%1:extension name%]]."
|
||||
|
||||
RLTA_ACCORDION_HANDLES="Accordion Handles"
|
||||
RLTA_ACCORDIONS="Accordions"
|
||||
RLTA_ADD_ICONS="Add Icons"
|
||||
RLTA_ADD_ICONS_DESC="Add a + or - icon to the accordion handles depending on the state of the slider."
|
||||
RLTA_ALIGNMENT_DESC="Select the alignment of the tab handles."
|
||||
RLTA_ANIMATION_SPEED_DESC="Set the speed of the animation effects.<br>1 = slow<br>10 = fast"
|
||||
RLTA_ANIMATIONS_DESC="Select whether the panels should animate when being opened/closed."
|
||||
RLTA_AUTOMATICALLY_SWITCH="Automatically Switch Tabs to Accordions"
|
||||
RLTA_BUTTON_SCROLL_LEFT="Scroll buttons to the left"
|
||||
RLTA_BUTTON_SCROLL_RIGHT="Scroll buttons to the right"
|
||||
RLTA_BUTTON_SCROLL_SPEED_DESC="Set the speed of the scrolling effect.<br>1 = slow<br>10 = fast"
|
||||
RLTA_CLASSNAME_DESC="The class name to use for the tab/accordion set."
|
||||
RLTA_CLOSING_TAG_ACCORDIONS="Closing Tag (Accordions)"
|
||||
RLTA_CLOSING_TAG_ACCORDIONS_DESC="The closing tag to use for the accordions."
|
||||
RLTA_CLOSING_TAG_TABS="Closing Tag (Tabs)"
|
||||
RLTA_CLOSING_TAG_TABS_DESC="The closing tag to use for the tabs."
|
||||
RLTA_COLOR_PANELS="Color Panels"
|
||||
RLTA_COLOR_PANELS_DESC="Select to apply colors to the background of the panels, when using colors."
|
||||
RLTA_DYNAMIC_HEIGHTS="Dynamic Heights"
|
||||
RLTA_DYNAMIC_HEIGHTS_DESC="Select to make the height of the active tab handle larger than the other tabs."
|
||||
RLTA_FIT_BUTTONS="Fit Buttons"
|
||||
RLTA_FIT_BUTTONS_DESC="Select how to fit the tab buttons when there are to many to fit the available width."
|
||||
RLTA_HIDE_INACTIVE_CONTENT="Hide Inactive Content"
|
||||
RLTA_HIDE_INACTIVE_CONTENT_DESC="Adds a hidden=\"true\"attribute to inactive (closed) tabs and accordions. This is necessary for accessibility reasons. If this causes problems with your template, you can disable this option."
|
||||
RLTA_MODE_DESC="Select whether the tabs/accordions should change on mouse click or hover."
|
||||
RLTA_NESTED_SET="Handle as Nested Set"
|
||||
RLTA_NESTED_SET_DESC="Select if this tab/accordion set is inside another set."
|
||||
RLTA_NESTED_SET_ID="Nested Set ID"
|
||||
RLTA_NESTED_SET_ID_DESC="Give the nested set an id. This should not be the same as any other nested set within the same parent tab/accordion set."
|
||||
RLTA_NOT_ALL_THEMES="This option does not have an effect on all themes."
|
||||
RLTA_OPENED_BY_DEFAULT="Opened by Default"
|
||||
RLTA_OPENED_BY_DEFAULT_DESC="Select to make this item opened by default."
|
||||
RLTA_OPENING_TAG_ACCORDIONS="Opening Tag (Accordions)"
|
||||
RLTA_OPENING_TAG_ACCORDIONS_DESC="The opening tag to use for the accordions."
|
||||
RLTA_OPENING_TAG_TABS="Opening Tag (Tabs)"
|
||||
RLTA_OPENING_TAG_TABS_DESC="The opening tag to use for the tabs."
|
||||
RLTA_PAGE_SCROLLING="Page Scrolling"
|
||||
RLTA_PAGE_SCROLLING_ADAPTIVE="Adaptive"
|
||||
RLTA_PAGE_SCROLLING_TOP="Top"
|
||||
RLTA_POSITIONING_DESC="Select the positioning of the tab handles."
|
||||
RLTA_REMEMBER_ACTIVE_ITEMS="Remember Active Items"
|
||||
RLTA_REMEMBER_ACTIVE_ITEMS_DESC="If selected, the active tab/accordion will be remembered when the page is reloaded."
|
||||
RLTA_SCROLL_BY_URL="Scroll by URL"
|
||||
RLTA_SCROLL_BY_URL_DESC="If selected, the window will scroll to the tab/accordion when it is opened via the URL."
|
||||
RLTA_SCROLL_OFFSET_BOTTOM="Scroll Offset Bottom"
|
||||
RLTA_SCROLL_OFFSET_BOTTOM_WIDE="Scroll Offset Bottom (wide screen)"
|
||||
RLTA_SCROLL_OFFSET_DESC="The scroll offset in pixels."
|
||||
RLTA_SCROLL_OFFSET_TOP="Scroll Offset Top"
|
||||
RLTA_SCROLL_OFFSET_TOP_WIDE="Scroll Offset Top (wide screen)"
|
||||
RLTA_SCROLL_ON_LINKS="Scroll on Links"
|
||||
RLTA_SCROLL_ON_LINKS_DESC="If selected, the window will scroll to the tab/accordion when it is opened via a link."
|
||||
RLTA_SCROLL_ON_OPEN="Scroll on Open"
|
||||
RLTA_SCROLL_ON_OPEN_DESC="If selected, the window will scroll to the tab/accordion when it gets opened."
|
||||
RLTA_SCROLLING_ADAPTIVE="Adaptive Scrolling"
|
||||
RLTA_SCROLLING_ADAPTIVE_DESC="The page will only scroll if the tab or accordion is not completely in view. If it is completely outside the view or partially visible at the top, it will scroll to the top. If it is partially visible at the bottom, it will scroll to the bottom."
|
||||
RLTA_SCROLLING_TOP="Top Scrolling"
|
||||
RLTA_SCROLLING_TOP_DESC="The page will scroll so that the tab or accordion is visible at the top of the view."
|
||||
RLTA_SET_CONTENT="Set Content"
|
||||
RLTA_SLIDESHOW="Slideshow"
|
||||
RLTA_SLIDESHOW_DESC="Select to make the tabs/accordions automatically open one-by-one using the default or given timeout."
|
||||
RLTA_SLIDESHOW_INTERVAL="Slideshow Interval"
|
||||
RLTA_SLIDESHOW_INTERVAL_DESC="The time each tab/accordion should show before going to the next (in milliseconds)."
|
||||
RLTA_SLIDESHOW_RESTART="Restart"
|
||||
RLTA_SLIDESHOW_RESTART_DESC="Select to make the slideshow restart after a certain time after it has stopped. The slideshow stops when interacting with the tab/accordion set."
|
||||
RLTA_SLIDESHOW_RESTART_TIMEOUT="Restart Timeout"
|
||||
RLTA_SLIDESHOW_RESTART_TIMEOUT_DESC="The time to wait before restarting the slideshow (in milliseconds)."
|
||||
RLTA_SWITCH_TO_ACCORDIONS="Switch to Accordions"
|
||||
RLTA_SWITCH_TO_ACCORDIONS_DESC="Select to automatically convert tabs to accordions on narrow screens."
|
||||
RLTA_TAB_HANDLES="Tab Handles"
|
||||
RLTA_TABS="Tabs"
|
||||
RLTA_THEME_ACCENT_LINES="Accent Lines"
|
||||
RLTA_THEME_COLORFUL="Colorful"
|
||||
RLTA_THEME_DARK="Dark"
|
||||
RLTA_THEME_LIGHT="Light"
|
||||
RLTA_THEME_LINES="Lines"
|
||||
RLTA_THEME_LINES_COLORFUL="Lines Colorful"
|
||||
RLTA_THEME_MINIMAL="Minimal"
|
||||
RLTA_THEME_NEUTRAL="Neutral"
|
||||
RLTA_THEME_PILLS="Pills"
|
||||
RLTA_THEME_PILLS_COLORFUL="Pills Colorful"
|
||||
RLTA_THEME_PILLS_DARK="Pills Dark"
|
||||
RLTA_THEME_PILLS_LIGHT="Pills Light"
|
||||
RLTA_THEME_PILLS_MINIMAL="Pills Minimal"
|
||||
RLTA_TITLE_TAG="Title tag"
|
||||
RLTA_TITLE_TAG_DESC="This is the tag type used for the tab and accordion titles."
|
||||
RLTA_USE_URL_HASH="Use URL Hash"
|
||||
RLTA_USE_URL_HASH_DESC="If selected, the active tab or accordion can be set via the hash fragment in the URL (#my-tab-title) and will be added to the URL when a tab or accordion is activated"
|
||||
RLTA_USE_WIDE_SCREEN_SCROLL_OFFSETS="Use Separate Wide Screen Offsets"
|
||||
RLTA_USE_WIDE_SCREEN_SCROLL_OFFSETS_DESC="If selected, separate scroll offsets will be used for wide screens."
|
||||
RLTA_WIDTH_BASED_ON="Base on Width of"
|
||||
RLTA_WIDTH_BASED_ON_DESC="Select the element to base the width on."
|
||||
RLTA_WIDTH_BREAK_POINT="Break Point"
|
||||
RLTA_WIDTH_BREAK_POINT_DESC="The width in pixels the screen is considered as wide."
|
||||
@@ -0,0 +1,13 @@
|
||||
;; @package Tabs & Accordions
|
||||
;; @version 2.0.0
|
||||
;;
|
||||
;; @author Peter van Westen <info@regularlabs.com>
|
||||
;; @link https://regularlabs.com
|
||||
;; @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
;; @license GNU General Public License version 2 or later
|
||||
;;
|
||||
;; @translate Want to help with translations? See: https://regularlabs.com/translate
|
||||
|
||||
PLG_SYSTEM_TABSACCORDIONS="System - Regular Labs - Tabs & Accordions"
|
||||
PLG_SYSTEM_TABSACCORDIONS_DESC="Tabs & Accordions - make content tabs and accordions in Joomla!"
|
||||
TABSACCORDIONS="Tabs & Accordions"
|
||||
69
plugins/system/tabsaccordions/layouts/button.php
Normal file
69
plugins/system/tabsaccordions/layouts/button.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
use RegularLabs\Library\HtmlTag as RL_HtmlTag;
|
||||
use RegularLabs\Plugin\System\TabsAccordions\Params;
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
/**
|
||||
* Layout variables
|
||||
* -----------------
|
||||
*
|
||||
* @var object $displayData
|
||||
* @var object $item
|
||||
* @var object $set
|
||||
*/
|
||||
|
||||
extract($displayData);
|
||||
|
||||
$params = Params::get();
|
||||
|
||||
$title_tag = $item->{'title-tag'} ?? $set->data->{'title-tag'} ?? $params->title_tag;
|
||||
$attributes = [
|
||||
'id' => 'rlta-' . $item->id,
|
||||
'role' => 'button',
|
||||
'aria-controls' => 'rlta-panel-' . $item->id,
|
||||
'aria-expanded' => $item->open ? 'true' : 'false',
|
||||
'tabindex' => '0',
|
||||
'class' => $item->class ?? null,
|
||||
];
|
||||
$data_attributes = [
|
||||
'alias' => $item->id,
|
||||
'element' => 'button',
|
||||
'state' => $item->open ? 'open' : 'closed',
|
||||
...(array) $item->data,
|
||||
];
|
||||
|
||||
$heading_attributes = [
|
||||
];
|
||||
$heading_data_attributes = [
|
||||
'element' => 'heading',
|
||||
];
|
||||
|
||||
$attributes = trim(
|
||||
RL_HtmlTag::flattenAttributes($attributes)
|
||||
. ' '
|
||||
. RL_HtmlTag::flattenAttributes($data_attributes, 'data-rlta-')
|
||||
);
|
||||
|
||||
$heading_attributes = trim(
|
||||
RL_HtmlTag::flattenAttributes($heading_attributes)
|
||||
. ' '
|
||||
. RL_HtmlTag::flattenAttributes($heading_data_attributes, 'data-rlta-')
|
||||
);
|
||||
|
||||
?>
|
||||
<div <?php echo $attributes; ?>>
|
||||
<<?php echo $title_tag; ?> <?php echo $heading_attributes; ?>>
|
||||
<?php echo $item->title ?>
|
||||
</<?php echo $title_tag; ?>>
|
||||
</div>
|
||||
15
plugins/system/tabsaccordions/layouts/container_end.php
Normal file
15
plugins/system/tabsaccordions/layouts/container_end.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
?>
|
||||
</div>
|
||||
40
plugins/system/tabsaccordions/layouts/container_start.php
Normal file
40
plugins/system/tabsaccordions/layouts/container_start.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
use RegularLabs\Library\HtmlTag as RL_HtmlTag;
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
/**
|
||||
* Layout variables
|
||||
* -----------------
|
||||
*
|
||||
* @var object $displayData
|
||||
*/
|
||||
|
||||
$set = $displayData;
|
||||
|
||||
$layout_path = JPATH_PLUGINS . '/system/tabsaccordions/layouts';
|
||||
|
||||
$attributes = [
|
||||
];
|
||||
$data_attributes = [
|
||||
'element' => 'container',
|
||||
'state' => 'initial', // @todo: set to null if pre-load styling is switched off
|
||||
...(array) $set->data,
|
||||
];
|
||||
|
||||
$attributes = trim(
|
||||
RL_HtmlTag::flattenAttributes($attributes)
|
||||
. ' ' . RL_HtmlTag::flattenAttributes($data_attributes, 'data-rlta-')
|
||||
);
|
||||
?>
|
||||
<div <?php echo $attributes; ?>>
|
||||
16
plugins/system/tabsaccordions/layouts/panel_end.php
Normal file
16
plugins/system/tabsaccordions/layouts/panel_end.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
62
plugins/system/tabsaccordions/layouts/panel_start.php
Normal file
62
plugins/system/tabsaccordions/layouts/panel_start.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
use RegularLabs\Library\HtmlTag as RL_HtmlTag;
|
||||
use RegularLabs\Plugin\System\TabsAccordions\Params;
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
/**
|
||||
* Layout variables
|
||||
* -----------------
|
||||
*
|
||||
* @var object $displayData
|
||||
* @var object $item
|
||||
* @var object $set
|
||||
*/
|
||||
|
||||
extract($displayData);
|
||||
|
||||
$params = Params::get();
|
||||
|
||||
$attributes = [
|
||||
'id' => 'rlta-panel-' . $item->id,
|
||||
'aria-labelledby' => 'rlta-' . $item->id,
|
||||
'tabindex' => '-1',
|
||||
'class' => $item->class ?? null,
|
||||
];
|
||||
|
||||
if ($params->hide_inactive_content && ! $item->open)
|
||||
{
|
||||
$attributes['hidden'] = true;
|
||||
}
|
||||
|
||||
$data_attributes = [
|
||||
'element' => 'panel',
|
||||
'state' => $item->open ? 'open' : 'closed',
|
||||
'color' => $item->color ?? false,
|
||||
];
|
||||
|
||||
$content_data_attributes = [
|
||||
'element' => 'panel-content',
|
||||
];
|
||||
|
||||
$attributes = trim(
|
||||
RL_HtmlTag::flattenAttributes($attributes)
|
||||
. ' ' . RL_HtmlTag::flattenAttributes($data_attributes, 'data-rlta-')
|
||||
);
|
||||
|
||||
$content_attributes = trim(
|
||||
RL_HtmlTag::flattenAttributes($content_data_attributes, 'data-rlta-')
|
||||
);
|
||||
?>
|
||||
<div <?php echo $attributes; ?>>
|
||||
<div <?php echo $content_attributes; ?>>
|
||||
168
plugins/system/tabsaccordions/src/Document.php
Normal file
168
plugins/system/tabsaccordions/src/Document.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
namespace RegularLabs\Plugin\System\TabsAccordions;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory as JFactory;
|
||||
use Joomla\CMS\Filesystem\File as JFile;
|
||||
use Joomla\CMS\Filesystem\Folder as JFolder;
|
||||
use Joomla\CMS\Language\Text as JText;
|
||||
use RegularLabs\Library\ArrayHelper as RL_Array;
|
||||
use RegularLabs\Library\Document as RL_Document;
|
||||
use RegularLabs\Library\Protect as RL_Protect;
|
||||
use RegularLabs\Library\RegEx as RL_RegEx;
|
||||
|
||||
class Document
|
||||
{
|
||||
static $all_themes;
|
||||
static $used_themes = [];
|
||||
|
||||
public static function loadStylesAndScripts(&$buffer)
|
||||
{
|
||||
self::loadScripts();
|
||||
self::loadStyles();
|
||||
}
|
||||
|
||||
public static function removeHeadStuff(&$html)
|
||||
{
|
||||
// Remove all scripts and styles if data-tabsaccordions attribute is not found
|
||||
if ( ! RL_RegEx::match('data-rlta', $html))
|
||||
{
|
||||
self::removeAllScriptsAndStyles($html);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise only remove the unused styles
|
||||
self::removeUnusedStyles($html);
|
||||
}
|
||||
|
||||
private static function getThemes()
|
||||
{
|
||||
if ( ! is_null(self::$all_themes))
|
||||
{
|
||||
return self::$all_themes;
|
||||
}
|
||||
|
||||
$folder = JPATH_SITE . '/media/tabsaccordions/css';
|
||||
$files = JFolder::files($folder, '^theme-[a-z0-9-_]+\.css$');
|
||||
|
||||
$template = JFactory::getApplication()->getTemplate();
|
||||
$folder = JPATH_SITE . '/media/templates/site/' . $template . '/css/tabsaccordions';
|
||||
|
||||
if (is_dir($folder))
|
||||
{
|
||||
$files_template = JFolder::files($folder, '^theme-[a-z0-9-_]+\.css$');
|
||||
$files_template = empty($files_template) ? [] : $files_template;
|
||||
$files = [...$files, ...$files_template];
|
||||
}
|
||||
|
||||
$files = array_unique($files);
|
||||
|
||||
$themes = [];
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$file_name = JFile::stripExt($file);
|
||||
$file_name = substr($file_name, 6);
|
||||
|
||||
$themes[] = $file_name;
|
||||
}
|
||||
|
||||
self::$all_themes = array_unique($themes);
|
||||
|
||||
return self::$all_themes;
|
||||
}
|
||||
|
||||
private static function getUsedThemes($html)
|
||||
{
|
||||
$params = Params::get();
|
||||
|
||||
$themes = [$params->theme];
|
||||
|
||||
if ( ! RL_RegEx::matchAll('data-rlta-theme="([^"]*)"', $html, $matches, null, PREG_PATTERN_ORDER))
|
||||
{
|
||||
return $themes;
|
||||
}
|
||||
|
||||
return array_unique([$themes, ...$matches[1]]);
|
||||
}
|
||||
|
||||
private static function loadScripts()
|
||||
{
|
||||
$params = Params::get();
|
||||
|
||||
$settings = (object) [
|
||||
'switchToAccordions' => (bool) ($params->switch_to_accordions ?? true),
|
||||
'switchBreakPoint' => (int) ($params->switch_break_point ?? 576),
|
||||
'buttonScrollSpeed' => max(1, min(10, (int) ($params->button_scroll_speed ?? 5))),
|
||||
'addHashToUrls' => (bool) ($params->use_url_hash ?? false),
|
||||
'rememberActive' => (bool) ($params->remember_active ?? false),
|
||||
'wrapButtons' => isset($params->fit_buttons) ? $params->fit_buttons == 'wrap' : false,
|
||||
];
|
||||
|
||||
RL_Document::script('tabsaccordions.script', ['defer' => true, 'type' => 'module']);
|
||||
RL_Document::scriptDeclaration(
|
||||
'rltaSettings = ' . json_encode($settings),
|
||||
'tabsaccordions'
|
||||
);
|
||||
|
||||
JText::script('RLTA_BUTTON_SCROLL_LEFT', true);
|
||||
JText::script('RLTA_BUTTON_SCROLL_RIGHT', true);
|
||||
}
|
||||
|
||||
private static function loadStyles()
|
||||
{
|
||||
$params = Params::get();
|
||||
|
||||
if ( ! $params->load_stylesheet)
|
||||
{
|
||||
RL_Document::style('tabsaccordions.theme-custom');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RL_Document::style('tabsaccordions.style');
|
||||
|
||||
$themes = self::getThemes();
|
||||
|
||||
foreach ($themes as $theme)
|
||||
{
|
||||
RL_Document::style('tabsaccordions.theme-' . $theme);
|
||||
}
|
||||
}
|
||||
|
||||
private static function removeAllScriptsAndStyles(&$html)
|
||||
{
|
||||
// Prevent the tabsaccordions.button and tabsaccordions.popup script from being removed
|
||||
RL_Protect::protectByRegex($html, '<script [^>]*src="[^"]*/(tabsaccordions/js|js/tabsaccordions)/(button|popup)\..*?>');
|
||||
|
||||
// remove style and script if no items are found
|
||||
RL_Document::removeScriptsStyles($html, 'tabsaccordions');
|
||||
RL_Document::removeScriptsOptions($html, 'tabsaccordions');
|
||||
|
||||
RL_Protect::unprotect($html);
|
||||
}
|
||||
|
||||
private static function removeUnusedStyles(&$html)
|
||||
{
|
||||
$all_themes = self::getThemes();
|
||||
$used_themes = self::getUsedThemes($html);
|
||||
$unused_themes = array_diff($all_themes, $used_themes);
|
||||
|
||||
foreach ($unused_themes as $theme)
|
||||
{
|
||||
RL_Document::removeStyleTag($html, 'tabsaccordions', 'theme-' . $theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
40
plugins/system/tabsaccordions/src/IDs.php
Normal file
40
plugins/system/tabsaccordions/src/IDs.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
namespace RegularLabs\Plugin\System\TabsAccordions;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use RegularLabs\Library\Alias as RL_Alias;
|
||||
|
||||
class IDs
|
||||
{
|
||||
private static array $ids = [];
|
||||
|
||||
public static function create($item, $prefix = '')
|
||||
{
|
||||
$alias = RL_Alias::get($item->alias ?? $item->name);
|
||||
$alias = $alias ?: 'tab';
|
||||
|
||||
$id = $prefix . $alias;
|
||||
|
||||
$i = 1;
|
||||
|
||||
while (in_array($id, self::$ids))
|
||||
{
|
||||
$id = $prefix . $alias . '-' . ++$i;
|
||||
}
|
||||
|
||||
self::$ids[] = $id;
|
||||
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
165
plugins/system/tabsaccordions/src/Params.php
Normal file
165
plugins/system/tabsaccordions/src/Params.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
namespace RegularLabs\Plugin\System\TabsAccordions;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory as JFactory;
|
||||
use RegularLabs\Library\Parameters as RL_Parameters;
|
||||
use RegularLabs\Library\PluginTag as RL_PluginTag;
|
||||
use RegularLabs\Library\RegEx as RL_RegEx;
|
||||
use RegularLabs\Library\Uri as RL_Uri;
|
||||
|
||||
class Params
|
||||
{
|
||||
protected static $params = null;
|
||||
protected static $regexes = null;
|
||||
|
||||
public static function get()
|
||||
{
|
||||
if ( ! is_null(self::$params))
|
||||
{
|
||||
return self::$params;
|
||||
}
|
||||
|
||||
$params = RL_Parameters::getPlugin('tabsaccordions');
|
||||
|
||||
$params->tag_tabs_open = RL_PluginTag::clean($params->tag_tabs_open);
|
||||
$params->tag_tabs_close = RL_PluginTag::clean($params->tag_tabs_close);
|
||||
$params->tag_accordions_open = RL_PluginTag::clean($params->tag_accordions_open);
|
||||
$params->tag_accordions_close = RL_PluginTag::clean($params->tag_accordions_close);
|
||||
|
||||
$params->use_responsive_view = false;
|
||||
|
||||
self::$params = $params;
|
||||
|
||||
return self::$params;
|
||||
}
|
||||
|
||||
public static function getAlignment()
|
||||
{
|
||||
$params = self::get();
|
||||
|
||||
|
||||
if ( ! $params->alignment)
|
||||
{
|
||||
$params->alignment = JFactory::getLanguage()->isRTL() ? 'right' : 'left';
|
||||
}
|
||||
|
||||
return 'align_' . $params->alignment;
|
||||
}
|
||||
|
||||
public static function getRegex($type = 'tag')
|
||||
{
|
||||
$regexes = self::getRegexes();
|
||||
|
||||
return $regexes->{$type} ?? $regexes->tag;
|
||||
}
|
||||
|
||||
public static function getTagCharacters()
|
||||
{
|
||||
$params = self::get();
|
||||
|
||||
if ( ! isset($params->tag_character_start))
|
||||
{
|
||||
self::setTagCharacters();
|
||||
}
|
||||
|
||||
return [$params->tag_character_start, $params->tag_character_end];
|
||||
}
|
||||
|
||||
public static function getTags($only_start_tags = false)
|
||||
{
|
||||
$params = self::get();
|
||||
|
||||
[$tag_start, $tag_end] = self::getTagCharacters();
|
||||
|
||||
$tags = [
|
||||
[
|
||||
$tag_start . $params->tag_tabs_open,
|
||||
$tag_start . $params->tag_accordions_open,
|
||||
],
|
||||
[
|
||||
$tag_start . '/' . $params->tag_tabs_close . $tag_end,
|
||||
$tag_start . '/' . $params->tag_accordions_close . $tag_end,
|
||||
],
|
||||
];
|
||||
|
||||
return $only_start_tags ? $tags[0] : $tags;
|
||||
}
|
||||
|
||||
public static function setTagCharacters()
|
||||
{
|
||||
$params = self::get();
|
||||
|
||||
[self::$params->tag_character_start, self::$params->tag_character_end] = explode('.', $params->tag_characters);
|
||||
}
|
||||
|
||||
private static function getRegexEnd()
|
||||
{
|
||||
$params = self::get();
|
||||
|
||||
[$tag_start, $tag_end] = self::getTagCharacters();
|
||||
|
||||
$pre = RL_PluginTag::getRegexSurroundingTagsPre();
|
||||
$post = RL_PluginTag::getRegexSurroundingTagsPost();
|
||||
$tag_start = RL_RegEx::quote($tag_start);
|
||||
$tag_end = RL_RegEx::quote($tag_end);
|
||||
|
||||
$set_id = '(?:-[a-zA-Z0-9-_]+)?';
|
||||
|
||||
return '(?<pre>' . $pre . ')'
|
||||
. $tag_start . '/(?<type>' . $params->tag_tabs_close . '|' . $params->tag_accordions_close . ')' . $set_id . $tag_end
|
||||
. '(?<post>' . $post . ')';
|
||||
}
|
||||
|
||||
private static function getRegexOpenByType($type = 'tabs')
|
||||
{
|
||||
$params = self::get();
|
||||
|
||||
[$tag_start, $tag_end] = self::getTagCharacters();
|
||||
|
||||
$pre = RL_PluginTag::getRegexSurroundingTagsPre();
|
||||
$post = RL_PluginTag::getRegexSurroundingTagsPost();
|
||||
$inside_tag = RL_PluginTag::getRegexInsideTag($tag_start, $tag_end);
|
||||
$tag_start = RL_RegEx::quote($tag_start);
|
||||
$tag_end = RL_RegEx::quote($tag_end);
|
||||
$space = RL_PluginTag::getRegexSpaces();
|
||||
$set_id = '(?:-[a-zA-Z0-9-_]+)?';
|
||||
|
||||
$open_tag = $type == 'accordions' ? $params->tag_accordions_open : $params->tag_tabs_open;
|
||||
$close_tag = $type == 'accordions' ? $params->tag_accordions_close : $params->tag_tabs_close;
|
||||
|
||||
return '(?<pre>' . $pre . ')'
|
||||
. $tag_start . '(?<tag>'
|
||||
. '(?<type>' . $open_tag . ')s?' . '(?<set_id>' . $set_id . ')' . $space . '(?<data>' . $inside_tag . ')'
|
||||
. '|/(?<type_close>' . $close_tag . ')' . $set_id
|
||||
. ')' . $tag_end
|
||||
. '(?<post>' . $post . ')';
|
||||
}
|
||||
|
||||
private static function getRegexes()
|
||||
{
|
||||
if ( ! is_null(self::$regexes))
|
||||
{
|
||||
return self::$regexes;
|
||||
}
|
||||
|
||||
self::$regexes = (object) [
|
||||
'tabs' => self::getRegexOpenByType('tabs'),
|
||||
'accordions' => self::getRegexOpenByType('accordions'),
|
||||
'end' => self::getRegexEnd(),
|
||||
];
|
||||
|
||||
return self::$regexes;
|
||||
}
|
||||
}
|
||||
70
plugins/system/tabsaccordions/src/Protect.php
Normal file
70
plugins/system/tabsaccordions/src/Protect.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
namespace RegularLabs\Plugin\System\TabsAccordions;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use RegularLabs\Library\Protect as RL_Protect;
|
||||
|
||||
class Protect
|
||||
{
|
||||
static $name = 'Tabs & Accordions';
|
||||
|
||||
public static function _(&$string)
|
||||
{
|
||||
RL_Protect::protectHtmlCommentTags($string);
|
||||
RL_Protect::protectFields($string, Params::getTags(true));
|
||||
RL_Protect::protectSourcerer($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the html end comment tags
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getCommentEndTag()
|
||||
{
|
||||
return RL_Protect::getCommentEndTag(self::$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the html start comment tags
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getCommentStartTag()
|
||||
{
|
||||
return RL_Protect::getCommentStartTag(self::$name);
|
||||
}
|
||||
|
||||
public static function protectTags(&$string)
|
||||
{
|
||||
RL_Protect::protectTags($string, Params::getTags(true));
|
||||
}
|
||||
|
||||
public static function unprotectTags(&$string)
|
||||
{
|
||||
RL_Protect::unprotectTags($string, Params::getTags(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap the comment in comment tags
|
||||
*
|
||||
* @param string $comment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function wrapInCommentTags($comment)
|
||||
{
|
||||
return RL_Protect::wrapInCommentTags(self::$name, $comment);
|
||||
}
|
||||
}
|
||||
234
plugins/system/tabsaccordions/src/Replace.php
Normal file
234
plugins/system/tabsaccordions/src/Replace.php
Normal file
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
namespace RegularLabs\Plugin\System\TabsAccordions;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route as JRoute;
|
||||
use Joomla\CMS\Uri\Uri as JUri;
|
||||
use RegularLabs\Library\Html as RL_Html;
|
||||
use RegularLabs\Library\Protect as RL_Protect;
|
||||
use RegularLabs\Library\RegEx as RL_RegEx;
|
||||
use RegularLabs\Library\StringHelper as RL_String;
|
||||
|
||||
/**
|
||||
* Class Output
|
||||
*
|
||||
* @package RegularLabs\Plugin\System\TabsAccordions
|
||||
*/
|
||||
class Replace
|
||||
{
|
||||
static $layout_path = JPATH_PLUGINS . '/system/tabsaccordions/layouts';
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function render(string &$string): string
|
||||
{
|
||||
Protect::_($string);
|
||||
|
||||
// Tag syntax: {tab ...}
|
||||
|
||||
self::replaceSyntax($string);
|
||||
|
||||
// Closing tag: {/tab}
|
||||
|
||||
self::replaceClosingTag($string);
|
||||
|
||||
// Links with #tab-name or &tab=tab-name
|
||||
self::replaceLinks($string);
|
||||
|
||||
RL_Protect::unprotect($string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
private static function replaceClosingTag(&$string)
|
||||
{
|
||||
$regex = Params::getRegex('end');
|
||||
|
||||
RL_RegEx::matchAll($regex, $string, $matches);
|
||||
|
||||
if (empty($matches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($matches as $match)
|
||||
{
|
||||
$html = [];
|
||||
|
||||
$html[] = LayoutHelper::render('panel_end', [], self::$layout_path);
|
||||
$html[] = LayoutHelper::render('container_end', [], self::$layout_path);
|
||||
|
||||
if (Params::get()->place_comments)
|
||||
{
|
||||
$html[] = Protect::getCommentEndTag();
|
||||
}
|
||||
|
||||
[$pre, $post] = RL_Html::cleanSurroundingTags([$match['pre'], $match['post']]);
|
||||
|
||||
$html = $pre . implode('', $html) . $post;
|
||||
|
||||
$string = RL_String::replaceOnce($match[0], $html, $string);
|
||||
}
|
||||
}
|
||||
|
||||
private static function replaceItem(&$string, $set, $item, $is_first)
|
||||
{
|
||||
$html = [];
|
||||
|
||||
if ($is_first && Params::get()->place_comments)
|
||||
{
|
||||
$html[] = Protect::getCommentStartTag();
|
||||
}
|
||||
|
||||
$html[] = $is_first
|
||||
? LayoutHelper::render(
|
||||
'container_start',
|
||||
$set,
|
||||
self::$layout_path
|
||||
)
|
||||
: LayoutHelper::render('panel_end', [], self::$layout_path);
|
||||
|
||||
$html[] = LayoutHelper::render('button', compact('item', 'set'), self::$layout_path);
|
||||
$html[] = LayoutHelper::render('panel_start', compact('item', 'set'), self::$layout_path);
|
||||
|
||||
$html = $item->pre . implode('', $html) . $item->post;
|
||||
|
||||
$string = RL_String::replaceOnce(
|
||||
$item->original_match,
|
||||
$html,
|
||||
$string
|
||||
);
|
||||
}
|
||||
|
||||
private static function replaceLinks(&$string)
|
||||
{
|
||||
// Links with #tab-name
|
||||
self::replaceLinksWithHashes($string);
|
||||
// Links with &tab=tab-name
|
||||
self::replaceLinksWithUrlParameters($string);
|
||||
}
|
||||
|
||||
private static function replaceLinksByRegEx(&$string, $regex)
|
||||
{
|
||||
RL_RegEx::matchAll(
|
||||
$regex,
|
||||
$string,
|
||||
$matches
|
||||
);
|
||||
|
||||
if (empty($matches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self::replaceLinksMatches($string, $matches);
|
||||
}
|
||||
|
||||
private static function replaceLinksMatches(&$string, $matches)
|
||||
{
|
||||
$uri = JUri::getInstance();
|
||||
$current_urls = [];
|
||||
$current_urls[] = $uri->toString(['path']);
|
||||
$current_urls[] = ltrim($uri->toString(['path']), '/');
|
||||
$current_urls[] = $uri->toString(['scheme', 'host', 'path']);
|
||||
$current_urls[] = $uri->toString(['scheme', 'host', 'path']) . '/';
|
||||
$current_urls[] = $uri->toString(['scheme', 'host', 'port', 'path']);
|
||||
$current_urls[] = $uri->toString(['scheme', 'host', 'port', 'path']) . '/';
|
||||
|
||||
foreach ($matches as $match)
|
||||
{
|
||||
$attributes = $match['attributes'];
|
||||
|
||||
if (
|
||||
str_contains($attributes, 'data-toggle=')
|
||||
|| str_contains($attributes, 'onclick=')
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$url = $match['url'];
|
||||
|
||||
if (str_starts_with($url, 'index.php/'))
|
||||
{
|
||||
$url = '/' . $url;
|
||||
}
|
||||
|
||||
if (str_starts_with($url, 'index.php'))
|
||||
{
|
||||
$url = JRoute::link('site', $url);
|
||||
}
|
||||
|
||||
if ($url != '' && ! in_array($url, $current_urls))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$id = $match['id'];
|
||||
|
||||
if ( ! self::stringHasItem($string, $id))
|
||||
{
|
||||
// This is a link to a normal anchor or other element on the page
|
||||
continue;
|
||||
}
|
||||
|
||||
$attributes .= ' onclick="RegularLabs.TabsAccordions.open(\'' . $id . '\');return false;"';
|
||||
|
||||
$string = str_replace($match[0], '<a ' . $attributes . '>', $string);
|
||||
}
|
||||
}
|
||||
|
||||
private static function replaceLinksWithHashes(&$string)
|
||||
{
|
||||
self::replaceLinksByRegEx(
|
||||
$string,
|
||||
'<a\s(?<attributes>[^>]*href="(?<url>[^"]*)\#(?<id>[^"]*)"[^>]*)>',
|
||||
);
|
||||
}
|
||||
|
||||
private static function replaceLinksWithUrlParameters(&$string)
|
||||
{
|
||||
self::replaceLinksByRegEx(
|
||||
$string,
|
||||
'<a\s(?<attributes>[^>]*href="(?<url>[^"]*)(?:\?|&(?:amp;)?)(?:tab|accordion)=(?<id>[^"\#&]*)(?:\#[^"]*)?"[^>]*)>',
|
||||
);
|
||||
}
|
||||
|
||||
private static function replaceSet(&$string, $set)
|
||||
{
|
||||
foreach ($set->items as $i => $item)
|
||||
{
|
||||
self::replaceItem($string, $set, $item, $i === 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static function replaceSyntax(&$string)
|
||||
{
|
||||
$sets = (new Sets)->get($string);
|
||||
|
||||
foreach ($sets as $set)
|
||||
{
|
||||
self::replaceSet($string, $set);
|
||||
}
|
||||
}
|
||||
|
||||
private static function stringHasItem(&$string, $id)
|
||||
{
|
||||
return (str_contains($string, 'data-rlta-alias="' . $id . '"'));
|
||||
}
|
||||
}
|
||||
489
plugins/system/tabsaccordions/src/Sets.php
Normal file
489
plugins/system/tabsaccordions/src/Sets.php
Normal file
@@ -0,0 +1,489 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
namespace RegularLabs\Plugin\System\TabsAccordions;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory as JFactory;
|
||||
use RegularLabs\Library\ArrayHelper as RL_Array;
|
||||
use RegularLabs\Library\Html as RL_Html;
|
||||
use RegularLabs\Library\HtmlTag as RL_HtmlTag;
|
||||
use RegularLabs\Library\ObjectHelper as RL_Object;
|
||||
use RegularLabs\Library\PluginTag as RL_PluginTag;
|
||||
use RegularLabs\Library\RegEx as RL_RegEx;
|
||||
use RegularLabs\Library\StringHelper;
|
||||
use RegularLabs\Library\Title as RL_Title;
|
||||
|
||||
/**
|
||||
* Class Output
|
||||
*
|
||||
* @package RegularLabs\Plugin\System\TabsAccordions
|
||||
*/
|
||||
class Sets
|
||||
{
|
||||
private array $colors = ['red', 'orange', 'yellow', 'green', 'teal', 'blue', 'indigo', 'purple', 'pink'];
|
||||
private array $matches = [];
|
||||
private array $random_colors = [];
|
||||
private int $set_count = 0;
|
||||
private array $sets = [];
|
||||
private $user_groups = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->user_groups = $this->getUserGroups();
|
||||
}
|
||||
|
||||
public function get(&$string)
|
||||
{
|
||||
$matches = $this->getMatches($string);
|
||||
|
||||
if (empty($matches))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->sets = [];
|
||||
$set_ids = [];
|
||||
|
||||
|
||||
foreach ($matches as $match)
|
||||
{
|
||||
if (str_starts_with($match['tag'], '/'))
|
||||
{
|
||||
if (empty($set_ids))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$set_id = key($set_ids);
|
||||
|
||||
array_pop($set_ids);
|
||||
|
||||
if (empty($set_id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->sets[$set_id]->items[0]->ending = $match[0];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
end($set_ids);
|
||||
|
||||
$item = $this->getItem($match, $set_ids);
|
||||
|
||||
|
||||
if ( ! isset($this->sets[$item->set]))
|
||||
{
|
||||
$this->sets[$item->set] = $this->getSet($item);
|
||||
}
|
||||
|
||||
$this->sets[$item->set]->items[] = $item;
|
||||
}
|
||||
|
||||
|
||||
$this->setData();
|
||||
|
||||
return $this->sets;
|
||||
}
|
||||
|
||||
private function addChildToParent($item)
|
||||
{
|
||||
if (empty($item->parent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[$parent_set, $parent_item] = $item->parent;
|
||||
|
||||
if (empty($this->sets[$parent_set]) || empty($this->sets[$parent_set]->items[$parent_item]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->sets[$parent_set]->items[$parent_item]->children[] = $item->set;
|
||||
}
|
||||
|
||||
private function getAccessLevels()
|
||||
{
|
||||
}
|
||||
|
||||
private function getItem($match, &$set_ids)
|
||||
{
|
||||
$params = Params::get();
|
||||
|
||||
$item = (object) [];
|
||||
|
||||
// Set the values from the tag
|
||||
$tag = RL_Title::clean($match['data'], false, false);
|
||||
$this->setTagAttributes($item, $tag);
|
||||
$item->original_match = $match[0];
|
||||
|
||||
$item->type = $match['type'] == $params->tag_accordions_open ? 'accordions' : 'tabs';
|
||||
|
||||
$item->set_id = trim(str_replace('-', '_', $match['set_id']));
|
||||
$item->data = (object) [];
|
||||
|
||||
// New set
|
||||
if (empty($set_ids) || current($set_ids) != $item->set_id)
|
||||
{
|
||||
$this->set_count++;
|
||||
$set_id = $this->set_count . $item->set_id;
|
||||
|
||||
$set_ids[$set_id] = $item->set_id;
|
||||
}
|
||||
|
||||
$item->set = array_search($item->set_id, array_reverse($set_ids, true));
|
||||
|
||||
$item->level = $this->getSetLevel($item->set, $set_ids);
|
||||
|
||||
|
||||
[$item->pre, $item->post] = RL_Html::cleanSurroundingTags(
|
||||
[$match['pre'], $match['post']],
|
||||
['div', 'p', 'span', 'h[0-6]']
|
||||
);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
private function getMatches($string)
|
||||
{
|
||||
$regex_end = Params::getRegex('end');
|
||||
|
||||
if ( ! RL_RegEx::match($regex_end, $string))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
$regex_tabs = Params::getRegex('tabs');
|
||||
RL_RegEx::matchAll($regex_tabs, $string, $matches_tabs);
|
||||
|
||||
$regex_accordions = Params::getRegex('accordions');
|
||||
RL_RegEx::matchAll($regex_accordions, $string, $matches_accordions);
|
||||
|
||||
return [...$matches_tabs, ...$matches_accordions];
|
||||
}
|
||||
|
||||
private function getParent($set_id, $level)
|
||||
{
|
||||
if (empty($this->sets))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($this->sets[$set_id]) && ! empty($this->sets[$set_id]->items))
|
||||
{
|
||||
return $this->sets[$set_id]->items[0]->parent;
|
||||
}
|
||||
|
||||
reset($this->sets);
|
||||
|
||||
$previous_set = current($this->sets);
|
||||
$prev_level = $previous_set->items[0]->level;
|
||||
|
||||
while ($prev_level >= $level)
|
||||
{
|
||||
$previous_set = prev($this->sets);
|
||||
|
||||
if (empty($previous_set))
|
||||
{
|
||||
end($this->sets);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$prev_level = $previous_set->items[0]->level;
|
||||
}
|
||||
|
||||
end($this->sets);
|
||||
end($previous_set->items);
|
||||
|
||||
$parent_item = key($previous_set->items);
|
||||
|
||||
return [$previous_set->items[$parent_item]->set, $parent_item];
|
||||
}
|
||||
|
||||
private function getRandomColorName($item)
|
||||
{
|
||||
if ( ! isset($this->random_colors[$item->set_id]))
|
||||
{
|
||||
// store colors in random order for this specific set
|
||||
$this->random_colors[$item->set_id] = array_values($this->colors);
|
||||
shuffle($this->random_colors[$item->set_id]);
|
||||
}
|
||||
|
||||
// get the color matching the current item count (will wrap if number is higher than number of colors)
|
||||
return $this->random_colors[$item->set_id][$item->count % count($this->random_colors[$item->set_id])];
|
||||
}
|
||||
|
||||
private function getSet($item)
|
||||
{
|
||||
$params = Params::get();
|
||||
|
||||
$type = $item->type ?? 'tabs';
|
||||
|
||||
$theme = $item->{'theme'} ?? $params->theme;
|
||||
$theme = in_array($theme, ['custom', 'neutral']) ? $theme : 'neutral';
|
||||
$positioning = 'top';
|
||||
$alignment = $item->{'align'} ?? $params->alignment;
|
||||
|
||||
$orientation = 'vertical';
|
||||
|
||||
if ($type == 'tabs' && ($positioning == 'top' || $positioning == 'bottom'))
|
||||
{
|
||||
$orientation = 'horizontal';
|
||||
}
|
||||
|
||||
return (object) [
|
||||
'items' => [],
|
||||
'data' => (object) [
|
||||
'id' => $item->set,
|
||||
|
||||
// Settings (needed for js)
|
||||
'type' => $type,
|
||||
'title-tag' => $item->{'title-tag'} ?? $params->title_tag,
|
||||
'orientation' => $orientation,
|
||||
'wrap-buttons' => (bool) ($item->{'wrap-buttons'} ?? false),
|
||||
'remember-active' => (bool) ($item->{'remember-active'} ?? false),
|
||||
'button-scroll-duration' => $item->{'button-scroll-duration'} ?? null,
|
||||
'switch-to-accordions' => $item->{'switch'} ?? null,
|
||||
'switch-break-point' => $item->{'break-point'} ?? null,
|
||||
|
||||
// Styling (only used by css)
|
||||
'theme' => $this->getThemeName($item->{'theme'} ?? $params->theme),
|
||||
'color-panels' => (bool) ($item->{'color-panels'} ?? $params->color_panels),
|
||||
'positioning' => $positioning,
|
||||
'alignment' => $alignment,
|
||||
'has-button-scroller' => false,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
private function getSetLevel($set_id, $set_ids)
|
||||
{
|
||||
// Sets are still empty, so this is the first set
|
||||
if (empty($this->sets))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Grab the level from the previous entry of this set
|
||||
if (isset($this->sets[$set_id]) && ! empty($this->sets[$set_id]->items))
|
||||
{
|
||||
return $this->sets[$set_id]->items[0]->level;
|
||||
}
|
||||
|
||||
// Look up the level of the previous set
|
||||
$previous_set_id = array_search(prev($set_ids), array_reverse($set_ids));
|
||||
|
||||
// Grab the level from the previous entry of this set
|
||||
if (isset($this->sets[$previous_set_id]) && ! empty($this->sets[$previous_set_id]->items))
|
||||
{
|
||||
return $this->sets[$previous_set_id]->items[0]->level + 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
private function getTagAttributes($string)
|
||||
{
|
||||
RL_PluginTag::protectSpecialChars($string);
|
||||
|
||||
RL_PluginTag::unprotectSpecialChars($string, true);
|
||||
|
||||
$known_boolean_keys = [
|
||||
'open', 'active', 'opened', 'default',
|
||||
'scroll', 'noscroll',
|
||||
'nooutline', 'outline_handles', 'outline_content', 'color_inactive_handles',
|
||||
];
|
||||
|
||||
// Get the values from the tag
|
||||
$attributes = RL_PluginTag::getAttributesFromString($string, 'title', $known_boolean_keys, '', []);
|
||||
|
||||
$key_aliases = [
|
||||
'title' => ['name'],
|
||||
'title-active' => ['title-open', 'title-opened'],
|
||||
'title-inactive' => ['title-close', 'title-closed'],
|
||||
'icons' => ['icon'],
|
||||
'open' => ['active', 'opened', 'default'],
|
||||
'access' => ['accesslevels', 'accesslevel'],
|
||||
'usergroup' => ['usergroups', 'group', 'groups'],
|
||||
'position' => ['positioning'],
|
||||
'align' => ['alignment'],
|
||||
'animations' => ['effect', 'effects', 'animate', 'animation'],
|
||||
'scroll' => ['scrolling'],
|
||||
'heading_attributes' => ['li_attributes'],
|
||||
'link_attributes' => ['a_attributes'],
|
||||
'body_attributes' => ['content_attributes'],
|
||||
];
|
||||
|
||||
return RL_Object::replaceKeys($attributes, $key_aliases);
|
||||
}
|
||||
|
||||
private function getThemeName($string)
|
||||
{
|
||||
return StringHelper::toDashCase($string, true);
|
||||
}
|
||||
|
||||
private function getUserGroups()
|
||||
{
|
||||
}
|
||||
|
||||
private function hasAccess($item)
|
||||
{
|
||||
}
|
||||
|
||||
private function hasAccessByList($levels, $list)
|
||||
{
|
||||
}
|
||||
|
||||
private function itemIsOpen($item, $urlitem, $is_first = false)
|
||||
{
|
||||
if ($item->haslink)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! empty($item->close))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($item->open))
|
||||
{
|
||||
return $item->open;
|
||||
}
|
||||
|
||||
if ($urlitem && in_array($urlitem, $item->matches))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($is_first)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function removeByAccess(&$string)
|
||||
{
|
||||
}
|
||||
|
||||
private function setData()
|
||||
{
|
||||
$params = Params::get();
|
||||
|
||||
$urlitem = JFactory::getApplication()->input->get('tab', '');
|
||||
$itemcount = 0;
|
||||
|
||||
foreach ($this->sets as $set_id => $set)
|
||||
{
|
||||
$opened_by_default = 0;
|
||||
|
||||
|
||||
foreach ($set->items as $i => $item)
|
||||
{
|
||||
$title = trim($item->title ?? ($item->type == 'accordions' ? 'Accordion' : 'Tab'));
|
||||
|
||||
if (isset($item->{'title-active'}) || isset($item->{'title-inactive'}))
|
||||
{
|
||||
$item->data->{'title-active'} = $item->{'title-active'} ?? $title;
|
||||
$item->data->{'title-inactive'} = $item->{'title-inactive'} ?? $title;
|
||||
|
||||
// Set main title (if not set) to the title-inactive, otherwise to title-active
|
||||
$item->title = ($item->title ?: $item->{'title-inactive'}) ?: $item->{'title-active'};
|
||||
}
|
||||
|
||||
$item->title = $item->title ?: $title;
|
||||
|
||||
$item->haslink = RL_RegEx::match('<a [^>]*>.*?</a>', $item->title);
|
||||
|
||||
$item->name = RL_Title::clean($item->title, true);
|
||||
$item->name = $item->name ?: RL_HtmlTag::getAttributeValue('title', $item->title);
|
||||
$item->name = $item->name ?: RL_HtmlTag::getAttributeValue('alt', $item->title);
|
||||
|
||||
$item->id = IDs::create($item);
|
||||
$item->set = (int) $set_id;
|
||||
$item->count = $i + 1;
|
||||
|
||||
$set_keys = [
|
||||
'class', 'title_tag', 'onclick',
|
||||
];
|
||||
|
||||
foreach ($set_keys as $key)
|
||||
{
|
||||
$item->{$key} ??= $params->{$key} ?? '';
|
||||
}
|
||||
|
||||
$item->matches = RL_Title::getUrlMatches([$item->id, $item->name]);
|
||||
$item->matches[] = ++$itemcount . '';
|
||||
$item->matches[] = $item->set . ($i + 1);
|
||||
|
||||
$item->matches = array_unique($item->matches);
|
||||
$item->matches = array_diff($item->matches, $this->matches);
|
||||
$this->matches = [...$this->matches, ...$item->matches];
|
||||
|
||||
if ($this->itemIsOpen($item, $urlitem, $i == 0))
|
||||
{
|
||||
$opened_by_default = $i;
|
||||
}
|
||||
|
||||
// Can be set to true after all items are checked based on the $opened_by_default id
|
||||
$item->open ??= null;
|
||||
|
||||
|
||||
if ( ! empty($item->color))
|
||||
{
|
||||
$item->data->color = $item->color == 'random'
|
||||
// get the color matching the current item id (will wrap if number is higher than number of colors)
|
||||
? $this->getRandomColorName($item)
|
||||
: $item->color;
|
||||
}
|
||||
|
||||
$this->sets[$set_id]->items[$i] = $item;
|
||||
}
|
||||
|
||||
$this->setOpenItem($this->sets[$set_id]->items, $opened_by_default);
|
||||
}
|
||||
}
|
||||
|
||||
private function setOpenItem(&$items, $opened_by_default = 0)
|
||||
{
|
||||
$opened_by_default = (int) $opened_by_default;
|
||||
|
||||
while (isset($items[$opened_by_default]) && $items[$opened_by_default]->haslink)
|
||||
{
|
||||
$opened_by_default++;
|
||||
}
|
||||
|
||||
if ( ! isset($items[$opened_by_default]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($items[$opened_by_default]->open === false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$items[$opened_by_default]->open = true;
|
||||
}
|
||||
|
||||
private function setTagAttributes(&$item, $string)
|
||||
{
|
||||
$values = $this->getTagAttributes($string);
|
||||
$item = (object) [...(array) $item, ...(array) $values];
|
||||
}
|
||||
}
|
||||
101
plugins/system/tabsaccordions/tabsaccordions.php
Normal file
101
plugins/system/tabsaccordions/tabsaccordions.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Tabs & Accordions
|
||||
* @version 2.0.0
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link https://regularlabs.com
|
||||
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory as JFactory;
|
||||
use Joomla\CMS\Language\Text as JText;
|
||||
use RegularLabs\Library\Document as RL_Document;
|
||||
use RegularLabs\Library\Extension as RL_Extension;
|
||||
use RegularLabs\Library\Html as RL_Html;
|
||||
use RegularLabs\Library\SystemPlugin as RL_SystemPlugin;
|
||||
use RegularLabs\Plugin\System\TabsAccordions\Document;
|
||||
use RegularLabs\Plugin\System\TabsAccordions\Params;
|
||||
use RegularLabs\Plugin\System\TabsAccordions\Replace;
|
||||
|
||||
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/regularlabs.xml')
|
||||
|| ! class_exists('RegularLabs\Library\Parameters')
|
||||
|| ! class_exists('RegularLabs\Library\DownloadKey')
|
||||
|| ! class_exists('RegularLabs\Library\SystemPlugin')
|
||||
)
|
||||
{
|
||||
JFactory::getLanguage()->load('plg_system_tabsaccordions', __DIR__);
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::sprintf('RLTA_EXTENSION_CAN_NOT_FUNCTION', JText::_('TABSACCORDIONS'))
|
||||
. ' ' . JText::_('RLTA_REGULAR_LABS_LIBRARY_NOT_INSTALLED'),
|
||||
'error'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! RL_Document::isJoomlaVersion(4, 'TABSACCORDIONS'))
|
||||
{
|
||||
RL_Extension::disable('tabsaccordions', 'plugin');
|
||||
|
||||
RL_Document::adminError(
|
||||
JText::sprintf('RL_PLUGIN_HAS_BEEN_DISABLED', JText::_('TABSACCORDIONS'))
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (true)
|
||||
{
|
||||
class PlgSystemTabsAccordions extends RL_SystemPlugin
|
||||
{
|
||||
public $_lang_prefix = 'RLTA';
|
||||
protected $_jversion = 4;
|
||||
public $_enable_in_admin = true;
|
||||
|
||||
public function __construct(&$subject, $config = [])
|
||||
{
|
||||
parent::__construct($subject, $config);
|
||||
|
||||
$params = Params::get();
|
||||
|
||||
$this->_enable_in_admin = $params->enable_admin;
|
||||
}
|
||||
|
||||
protected function loadStylesAndScripts(&$buffer)
|
||||
{
|
||||
Document::loadStylesAndScripts($buffer);
|
||||
}
|
||||
|
||||
public function processArticle(&$string, $area = 'article', $context = '', $article = null, $page = 0)
|
||||
{
|
||||
Replace::render($string);
|
||||
}
|
||||
|
||||
protected function changeDocumentBuffer(&$buffer)
|
||||
{
|
||||
return Replace::render($buffer);
|
||||
}
|
||||
|
||||
protected function changeFinalHtmlOutput(&$html)
|
||||
{
|
||||
[$pre, $body, $post] = RL_Html::getBody($html);
|
||||
|
||||
$body = Replace::render($body);
|
||||
|
||||
$html = $pre . $body . $post;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function cleanFinalHtmlOutput(&$html)
|
||||
{
|
||||
Document::removeHeadStuff($html);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
161
plugins/system/tabsaccordions/tabsaccordions.xml
Normal file
161
plugins/system/tabsaccordions/tabsaccordions.xml
Normal file
@@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="4" type="plugin" group="system" method="upgrade">
|
||||
<name>PLG_SYSTEM_TABSACCORDIONS</name>
|
||||
<description>PLG_SYSTEM_TABSACCORDIONS_DESC</description>
|
||||
<version>2.0.0</version>
|
||||
<creationDate>September 2023</creationDate>
|
||||
<author>Regular Labs (Peter van Westen)</author>
|
||||
<authorEmail>info@regularlabs.com</authorEmail>
|
||||
<authorUrl>https://regularlabs.com</authorUrl>
|
||||
<copyright>Copyright © 2023 Regular Labs - All Rights Reserved</copyright>
|
||||
<license>GNU General Public License version 2 or later</license>
|
||||
<namespace path="src">RegularLabs\Plugin\System\TabsAccordions</namespace>
|
||||
<files>
|
||||
<file plugin="tabsaccordions">tabsaccordions.php</file>
|
||||
<folder>language</folder>
|
||||
<folder>layouts</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<media folder="media" destination="tabsaccordions">
|
||||
<folder>css</folder>
|
||||
<folder>js</folder>
|
||||
<folder>scss</folder>
|
||||
</media>
|
||||
<config>
|
||||
<fields name="params" addfieldprefix="RegularLabs\Library\Form\Field">
|
||||
<fieldset name="basic">
|
||||
<field name="@load_script_descriptions" type="LoadMedia" filetype="script" file="regularlabs.admin-form-descriptions"/>
|
||||
<field name="@load_language_regularlabs" type="LoadLanguage" extension="plg_system_regularlabs"/>
|
||||
<field name="@jcompatibility" type="JCompatibility" extension="TABSACCORDIONS"/>
|
||||
<field name="@license" type="License" extension="TABSACCORDIONS"/>
|
||||
<field name="@version" type="Version" extension="TABSACCORDIONS"/>
|
||||
<field name="@header" type="Header" label="TABSACCORDIONS" description="TABSACCORDIONS_DESC" url="https://regularlabs.com/tabsaccordions"/>
|
||||
</fieldset>
|
||||
<fieldset name="RL_STYLING">
|
||||
<field name="theme" type="List" default="neutral" class="w-auto" label="RL_THEME" description="RL_THEME_DESC">
|
||||
<option value="neutral">RLTA_THEME_NEUTRAL</option>
|
||||
<option value="custom">RL_CUSTOM</option>
|
||||
<option disabled="disabled">---</option>
|
||||
<option disabled="disabled">RL_ONLY_AVAILABLE_IN_PRO_LIST_OPTION</option>
|
||||
<option disabled="disabled">RLTA_THEME_ACCENT_LINES</option>
|
||||
<option disabled="disabled">RLTA_THEME_COLORFUL</option>
|
||||
<option disabled="disabled">RLTA_THEME_DARK</option>
|
||||
<option disabled="disabled">RLTA_THEME_LIGHT</option>
|
||||
<option disabled="disabled">RLTA_THEME_LINES</option>
|
||||
<option disabled="disabled">RLTA_THEME_LINES_COLORFUL</option>
|
||||
<option disabled="disabled">RLTA_THEME_MINIMAL</option>
|
||||
<option disabled="disabled">RLTA_THEME_PILLS</option>
|
||||
<option disabled="disabled">RLTA_THEME_PILLS_COLORFUL</option>
|
||||
<option disabled="disabled">RLTA_THEME_PILLS_DARK</option>
|
||||
<option disabled="disabled">RLTA_THEME_PILLS_LIGHT</option>
|
||||
<option disabled="disabled">RLTA_THEME_PILLS_MINIMAL</option>
|
||||
</field>
|
||||
<field name="color_panels" type="Radio" layout="joomla.form.field.radio.switcher" default="0" label="RLTA_COLOR_PANELS" description="%s<br><br><em>%s</em>,RLTA_COLOR_PANELS_DESC,RLTA_NOT_ALL_THEMES">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="load_stylesheet" type="Radio" layout="joomla.form.field.radio.switcher" default="1" label="RL_LOAD_STYLESHEET" description="RL_LOAD_STYLESHEET_DESC">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="@block__tab_handles__a" type="Block" start="1" label="RLTA_TAB_HANDLES"/>
|
||||
<field name="@note__dynamic_heights" type="OnlyPro" label="RLTA_DYNAMIC_HEIGHTS" description="RLTA_DYNAMIC_HEIGHTS_DESC"/>
|
||||
<field name="@note__positioning" type="Radio" class="btn-group" default="top" label="RL_POSITIONING" description="RLTA_POSITIONING_DESC">
|
||||
<option value="top" class="btn btn-outline-info">%s %s,<span class="icon-arrow-up-4"></span>,RL_TOP</option>
|
||||
<option value="" disabled="disabled">%s %s,<span class="icon-arrow-down-4"></span>,RL_BOTTOM</option>
|
||||
<option value="" disabled="disabled">%s %s,<span class="icon-arrow-left-4"></span>,RL_LEFT</option>
|
||||
<option value="" disabled="disabled">%s %s,<span class="icon-arrow-right-4"></span>,RL_RIGHT</option>
|
||||
</field>
|
||||
<field name="@note__positioning_2" label="---" type="OnlyPro"/>
|
||||
<field name="alignment" type="Radio" default="justify" class="btn-group" label="RL_ALIGNMENT" description="RLTA_ALIGNMENT_DESC" showon="positioning:top[OR]positioning:bottom">
|
||||
<option value="left" class="btn btn-outline-info">%s %s,<span class="icon-paragraph-left"></span>,RL_LEFT</option>
|
||||
<option value="center" class="btn btn-outline-info">%s %s,<span class="icon-paragraph-center"></span>,RL_CENTER</option>
|
||||
<option value="right" class="btn btn-outline-info">%s %s,<span class="icon-paragraph-right"></span>,RL_RIGHT</option>
|
||||
<option value="justify" class="btn btn-outline-info">%s %s,<span class="icon-paragraph-justify"></span>,RL_JUSTIFY</option>
|
||||
</field>
|
||||
<field name="@block__tab_handles__b" type="Block" end="1"/>
|
||||
<field name="@block__accordion_handles__a" type="Block" start="1" label="RLTA_ACCORDION_HANDLES"/>
|
||||
<field name="@note__add_icons" type="OnlyPro" label="RLTA_ADD_ICONS" description="RLTA_ADD_ICONS_DESC"/>
|
||||
<field name="@block__accordion_handles__b" type="Block" end="1"/>
|
||||
</fieldset>
|
||||
<fieldset name="RL_BEHAVIOUR">
|
||||
<field name="@block__switch__a" type="Block" start="1" label="RLTA_AUTOMATICALLY_SWITCH"/>
|
||||
<field name="switch_to_accordions" type="Radio" layout="joomla.form.field.radio.switcher" default="1" label="RLTA_SWITCH_TO_ACCORDIONS" description="RLTA_SWITCH_TO_ACCORDIONS_DESC">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="@showon__switch_to_accordions__a" type="ShowOn" value="switch_to_accordions:1"/>
|
||||
<field name="@note__switch_based_on" type="Radio" class="btn-group" default="top" label="RL_WIDTH_BASED_ON" description="RL_WIDTH_BASED_ON_DESC">
|
||||
<option value="element" disabled="disabled">%s %s,<span class="icon-drawer-2"></span>,RL_ELEMENT</option>
|
||||
<option value="" class="btn btn-outline-info">%s %s,<span class="icon-expand"></span>,RL_WINDOW</option>
|
||||
<option value="" disabled="disabled">%s %s,<span class="icon-screen"></span>,RL_SCREEN</option>
|
||||
</field>
|
||||
<field name="@note__switch_based_on_2" label="---" type="OnlyPro"/>
|
||||
<field name="switch_break_point" type="Range" default="576" min="200" max="1200" step="1" label="RL_WIDTH_BREAK_POINT" description="RL_WIDTH_BREAK_POINT_DESC"/>
|
||||
<field name="@showon__switch_to_accordions__b" type="ShowOn"/>
|
||||
<field name="@block__switch__b" type="Block" end="1"/>
|
||||
<field name="@block__animations__a" type="Block" start="1" label="RL_ANIMATIONS"/>
|
||||
<field name="@note__animations" type="OnlyPro" label="RL_ANIMATIONS" description="RLTA_ANIMATIONS_DESC"/>
|
||||
<field name="@block__animations__b" type="Block" end="1"/>
|
||||
<field name="@block__navigation__a" type="Block" start="1" label="RL_NAVIGATION"/>
|
||||
<field name="@note__mode" type="OnlyPro" label="RL_MODE" description="RLTA_MODE_DESC"/>
|
||||
<field name="fit_buttons" type="Radio" default="scroll" label="RLTA_FIT_BUTTONS" description="RLTA_FIT_BUTTONS_DESC">
|
||||
<option value="scroll">RL_SCROLL</option>
|
||||
<option value="wrap">RL_WRAP</option>
|
||||
</field>
|
||||
<field name="button_scroll_speed" type="Range" default="5" min="1" max="10" label="RLTA_SPEED" description="RLTA_BUTTON_SCROLL_SPEED_DESC" showon="fit_buttons:scroll"/>
|
||||
<field name="@block__navigation__b" type="Block" end="1"/>
|
||||
<field name="@block__scroll__a" type="Block" start="1" label="RLTA_PAGE_SCROLLING"/>
|
||||
<field name="@note__scrolling_top" type="Note" class="alert alert-info" title="RLTA_SCROLLING_TOP" text="RLTA_SCROLLING_TOP_DESC"/>
|
||||
<field name="@note__scrolling_adaptive" type="Note" class="alert alert-info" title="RLTA_SCROLLING_ADAPTIVE" text="RLTA_SCROLLING_ADAPTIVE_DESC"/>
|
||||
<field name="@note__scroll_on_open" type="OnlyPro" label="RLTA_SCROLL_ON_OPEN" description="RLTA_SCROLL_ON_OPEN_DESC"/>
|
||||
<field name="@note__scroll_by_links" type="OnlyPro" label="RLTA_SCROLL_ON_LINKS" description="RLTA_SCROLL_ON_LINKS_DESC"/>
|
||||
<field name="@note__scroll_by_url" type="OnlyPro" label="RLTA_SCROLL_BY_URL" description="RLTA_SCROLL_BY_URL_DESC"/>
|
||||
<field name="@block__slideshow__b" type="Block" end="1"/>
|
||||
</fieldset>
|
||||
<fieldset name="RL_SETTINGS_EDITOR_BUTTON">
|
||||
<field name="button_text" type="Text" default="Tabs & Accordions" label="RL_BUTTON_TEXT" description="RL_BUTTON_TEXT_DESC"/>
|
||||
<field name="enable_frontend" type="Radio" layout="joomla.form.field.radio.switcher" default="1" label="RL_ENABLE_IN_FRONTEND" description="RL_ENABLE_IN_FRONTEND_DESC">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="RL_TAG_SYNTAX">
|
||||
<field name="tag_tabs_open" type="Text" size="20" class="font-monospace rl-w-20em" default="tab" label="RLTA_OPENING_TAG_TABS" description="RLTA_OPENING_TAG_TABS_DESC"/>
|
||||
<field name="tag_tabs_close" type="Text" size="20" class="font-monospace rl-w-20em" default="tabs" label="RLTA_CLOSING_TAG_TABS" description="RLTA_CLOSING_TAG_TABS_DESC"/>
|
||||
<field name="tag_accordions_open" type="Text" size="20" class="font-monospace rl-w-20em" default="accordion" label="RLTA_OPENING_TAG_ACCORDIONS" description="RLTA_OPENING_TAG_ACCORDIONS_DESC"/>
|
||||
<field name="tag_accordions_close" type="Text" size="20" class="font-monospace rl-w-20em" default="accordions" label="RLTA_CLOSING_TAG_ACCORDIONS" description="RLTA_CLOSING_TAG_ACCORDIONS_DESC"/>
|
||||
<field name="tag_characters" type="List" class="font-monospace w-auto" default="{.}" label="RL_TAG_CHARACTERS" description="RL_TAG_CHARACTERS_DESC">
|
||||
<option value="{.}">{...}</option>
|
||||
<option value="[.]">[...]</option>
|
||||
<option value="«.»">«...»</option>
|
||||
<option value="{{.}}">{{...}}</option>
|
||||
<option value="[[.]]">[[...]]</option>
|
||||
<option value="[:.:]">[:...:]</option>
|
||||
<option value="[%.%]">[%...%]</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field name="title_tag" type="Text" size="5" class="font-monospace rl-w-5em" default="h3" label="RLTA_TITLE_TAG" description="RLTA_TITLE_TAG_DESC"/>
|
||||
<field name="use_url_hash" type="Radio" layout="joomla.form.field.radio.switcher" default="1" label="RLTA_USE_URL_HASH" description="RLTA_USE_URL_HASH_DESC">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="hide_inactive_content" type="Radio" layout="joomla.form.field.radio.switcher" default="1" label="RLTA_HIDE_INACTIVE_CONTENT" description="RLTA_HIDE_INACTIVE_CONTENT_DESC">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="@note__remember_active" type="OnlyPro" label="RLTA_REMEMBER_ACTIVE_ITEMS" description="RLTA_REMEMBER_ACTIVE_ITEMS_DESC"/>
|
||||
<field name="@note__disabled_components" type="OnlyPro" label="RL_DISABLE_ON_COMPONENTS" description="RL_DISABLE_ON_COMPONENTS_DESC"/>
|
||||
<field name="enable_admin" type="Radio" layout="joomla.form.field.radio.switcher" default="0" label="RL_ENABLE_IN_ADMIN" description="RL_ENABLE_IN_ADMIN_DESC">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="place_comments" type="Radio" layout="joomla.form.field.radio.switcher" default="1" label="RL_PLACE_HTML_COMMENTS" description="RL_PLACE_HTML_COMMENTS_DESC">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
Reference in New Issue
Block a user