From d5512492f08aa72c51205f65021b3b179ed943cc Mon Sep 17 00:00:00 2001 From: chmst Date: Wed, 21 Jul 2021 15:19:00 +0200 Subject: [PATCH] Adapt weblinks modal to J4 --- .../com_weblinks/tmpl/weblinks/modal.php | 81 ++++++++++--------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/src/administrator/components/com_weblinks/tmpl/weblinks/modal.php b/src/administrator/components/com_weblinks/tmpl/weblinks/modal.php index a38fe03..ee87fb8 100644 --- a/src/administrator/components/com_weblinks/tmpl/weblinks/modal.php +++ b/src/administrator/components/com_weblinks/tmpl/weblinks/modal.php @@ -6,6 +6,7 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ + defined('_JEXEC') or die; use Joomla\CMS\Factory; @@ -14,31 +15,29 @@ use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; use Joomla\Component\Weblinks\Site\Helper\RouteHelper; $app = Factory::getApplication(); if ($app->isClient('site')) { - JSession::checkToken('get') or die(Text::_('JINVALID_TOKEN')); + Session::checkToken('get') or die(Text::_('JINVALID_TOKEN')); } -// Include the component HTML helpers. +HTMLHelper::_('behavior.multiselect'); -HTMLHelper::_('behavior.core'); -HTMLHelper::_('script', 'com_weblinks/admin-weblinks-modal.js', array('version' => 'auto', 'relative' => true)); -HTMLHelper::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); -HTMLHelper::_('formbehavior.chosen', 'select'); - -// Special case for the search field tooltip. -$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter'); -HTMLHelper::_('bootstrap.tooltip', '#filter_search', array('title' => Text::_($searchFilterDesc), 'placement' => 'bottom')); +/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ +$wa = $this->document->getWebAssetManager(); +$wa->useScript('core') + ->useScript('com_weblinks.admin-weblinks-modal'); $function = $app->input->getCmd('function', 'jSelectWeblink'); $editor = $app->input->getCmd('editor', ''); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $onclick = $this->escape($function); +$multilang = Multilanguage::isEnabled(); if (!empty($editor)) { @@ -57,48 +56,49 @@ $iconStates = array( ?>
-
- $this)); ?> -
+ + + $this)); ?> + items)) : ?>
- +
+ - - - - - + + - - - - - - items as $i => $item) : ?> - language && Multilanguage::isEnabled()) : ?> + language && $multilang) : ?> language); ?> language, 0, 2); ?> @@ -110,7 +110,7 @@ $iconStates = array( - - - + + - @@ -143,6 +145,9 @@ $iconStates = array(
+ , + , + +
+ + + - - + + + + +
- pagination->getListFooter(); ?> -
+ escape($onclick) . '"' . ' data-id="' . $item->id . '"' . ' data-title="' . $this->escape(addslashes($item->title)) . '"' @@ -124,17 +124,19 @@ $iconStates = array(
escape($item->category_title); ?>
- -
+ + escape($item->access_level); ?> - - + + + + created, Text::_('DATE_FORMAT_LC4')); ?> + id; ?>
+ + pagination->getListFooter(); ?> +