From f7519475f148b720800298ded3a8f6dd9b591f57 Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Fri, 16 Aug 2019 15:52:52 +0200 Subject: [PATCH] Make it joomla 4 compatible (#362) --- .../components/com_weblinks/models/forms/weblink.xml | 1 + .../components/com_weblinks/tables/weblink.php | 9 ++++++--- .../components/com_weblinks/views/weblinks/view.html.php | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/administrator/components/com_weblinks/models/forms/weblink.xml b/src/administrator/components/com_weblinks/models/forms/weblink.xml index a708d40..5bebeb9 100644 --- a/src/administrator/components/com_weblinks/models/forms/weblink.xml +++ b/src/administrator/components/com_weblinks/models/forms/weblink.xml @@ -38,6 +38,7 @@ label="JCATEGORY" description="COM_WEBLINKS_FIELD_CATEGORY_DESC" extension="com_weblinks" + addfieldprefix="Joomla\Component\Categories\Administrator\Field" required="true" default="" /> diff --git a/src/administrator/components/com_weblinks/tables/weblink.php b/src/administrator/components/com_weblinks/tables/weblink.php index a4963fb..4cd90cc 100644 --- a/src/administrator/components/com_weblinks/tables/weblink.php +++ b/src/administrator/components/com_weblinks/tables/weblink.php @@ -38,8 +38,11 @@ class WeblinksTableWeblink extends JTable // Set the published column alias $this->setColumnAlias('published', 'state'); - JTableObserverTags::createObserver($this, array('typeAlias' => 'com_weblinks.weblink')); - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_weblinks.weblink')); + if (version_compare(JVERSION, '4.0', '<' ) == 1) + { + JTableObserverTags::createObserver($this, array('typeAlias' => 'com_weblinks.weblink')); + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_weblinks.weblink')); + } } /** @@ -194,6 +197,6 @@ class WeblinksTableWeblink extends JTable $this->metakey = implode(", ", $clean_keys); } - return true; + return parent::check(); } } diff --git a/src/administrator/components/com_weblinks/views/weblinks/view.html.php b/src/administrator/components/com_weblinks/views/weblinks/view.html.php index cc37c83..f97955f 100644 --- a/src/administrator/components/com_weblinks/views/weblinks/view.html.php +++ b/src/administrator/components/com_weblinks/views/weblinks/view.html.php @@ -93,7 +93,7 @@ class WeblinksViewWeblinks extends JViewLegacy $user = JFactory::getUser(); // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = JToolbar::getInstance('toolbar'); JToolbarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'link weblinks'); @@ -129,7 +129,7 @@ class WeblinksViewWeblinks extends JViewLegacy if ($user->authorise('core.create', 'com_weblinks') && $user->authorise('core.edit', 'com_weblinks') && $user->authorise('core.edit.state', 'com_weblinks')) { - JHtml::_('bootstrap.modal', 'collapseModal'); + JHtml::_('bootstrap.renderModal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button