From 664e59972f38fec1ffb2fe87ad70d71f39b2b4be Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Mon, 18 Oct 2021 23:12:54 +0200 Subject: [PATCH] Added first changes suggested by @ohrionmartin in vdm-io/Joomla-Component-Builder#126 --- README.md | 2 +- admin/README.txt | 2 +- admin/sql/install.mysql.utf8.sql | 2 +- admin/tables/look.php | 2 +- admin/views/look/tmpl/edit.php | 3 +-- admin/views/looks/tmpl/default.php | 1 - script.php | 27 ++++++++++++++------------- site/models/looking.php | 4 ++-- site/views/look/tmpl/edit.php | 5 +---- 9 files changed, 22 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 6b6461a..cf10607 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **16817** ++ *Line count*: **16813** + *File count*: **156** + *Folder count*: **57** diff --git a/admin/README.txt b/admin/README.txt index 6b6461a..cf10607 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -23,7 +23,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **16817** ++ *Line count*: **16813** + *File count*: **156** + *Folder count*: **57** diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 096bed3..327ebde 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `#__demo_look` ( `mobile_phone` VARCHAR(64) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', `website` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NOT NULL, + `params` text NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, diff --git a/admin/tables/look.php b/admin/tables/look.php index dd46512..f8f362b 100644 --- a/admin/tables/look.php +++ b/admin/tables/look.php @@ -332,7 +332,7 @@ class DemoTableLook extends JTable $this->alias = $this->name; } - $this->alias = JApplication::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { diff --git a/admin/views/look/tmpl/edit.php b/admin/views/look/tmpl/edit.php index b013e19..9c00b1f 100644 --- a/admin/views/look/tmpl/edit.php +++ b/admin/views/look/tmpl/edit.php @@ -22,8 +22,7 @@ defined('_JEXEC') or die('Restricted access'); JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead diff --git a/admin/views/looks/tmpl/default.php b/admin/views/looks/tmpl/default.php index 27ae268..a50d88f 100644 --- a/admin/views/looks/tmpl/default.php +++ b/admin/views/looks/tmpl/default.php @@ -21,7 +21,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::_('behavior.tooltip'); JHtml::_('behavior.multiselect'); JHtml::_('dropdown.init'); JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_DEMO_FILTER_SELECT_ACCESS') . ' -')); diff --git a/script.php b/script.php index c92a1c2..341ca24 100644 --- a/script.php +++ b/script.php @@ -23,7 +23,8 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; -JHTML::_('behavior.modal'); +use Joomla\CMS\Installer\Adapter\ComponentAdapter; +JHTML::_('bootstrap.renderModal'); /** * Script File of Demo Component @@ -35,23 +36,23 @@ class com_demoInstallerScript * * @param JAdapterInstance $parent The object responsible for running this script */ - public function __construct(JAdapterInstance $parent) {} + public function __construct(ComponentAdapter $parent) {} /** * Called on installation * - * @param JAdapterInstance $parent The object responsible for running this script + * @param ComponentAdapter $parent The object responsible for running this script * * @return boolean True on success */ - public function install(JAdapterInstance $parent) {} + public function install(ComponentAdapter $parent) {} /** * Called on uninstallation * - * @param JAdapterInstance $parent The object responsible for running this script + * @param ComponentAdapter $parent The object responsible for running this script */ - public function uninstall(JAdapterInstance $parent) + public function uninstall(ComponentAdapter $parent) { // Get Application object $app = JFactory::getApplication(); @@ -408,21 +409,21 @@ class com_demoInstallerScript /** * Called on update * - * @param JAdapterInstance $parent The object responsible for running this script + * @param ComponentAdapter $parent The object responsible for running this script * * @return boolean True on success */ - public function update(JAdapterInstance $parent){} + public function update(ComponentAdapter $parent){} /** * Called before any type of action * * @param string $type Which action is happening (install|uninstall|discover_install|update) - * @param JAdapterInstance $parent The object responsible for running this script + * @param ComponentAdapter $parent The object responsible for running this script * * @return boolean True on success */ - public function preflight($type, JAdapterInstance $parent) + public function preflight($type, ComponentAdapter $parent) { // get application $app = JFactory::getApplication(); @@ -461,11 +462,11 @@ class com_demoInstallerScript * Called after any type of action * * @param string $type Which action is happening (install|uninstall|discover_install|update) - * @param JAdapterInstance $parent The object responsible for running this script + * @param ComponentAdapter $parent The object responsible for running this script * * @return boolean True on success */ - public function postflight($type, JAdapterInstance $parent) + public function postflight($type, ComponentAdapter $parent) { // get application $app = JFactory::getApplication(); @@ -505,7 +506,7 @@ class com_demoInstallerScript $db->setQuery($query); $allDone = $db->execute(); - // Install the global extenstion params. + // Install the global extension params. $query = $db->getQuery(true); // Field to update. $fields = array( diff --git a/site/models/looking.php b/site/models/looking.php index 12f10cc..ff408ed 100644 --- a/site/models/looking.php +++ b/site/models/looking.php @@ -142,14 +142,14 @@ class DemoModelLooking extends JModelItem } // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); // Check if item has params, or pass whole item. $params = (isset($data->params) && DemoHelper::checkJson($data->params)) ? json_decode($data->params) : $data; // Make sure the content prepare plugins fire on description $_description = new stdClass(); $_description->text =& $data->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_demo.looking.description', &$_description, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_demo.looking.description', &$_description, &$params, 0)); // Checking if description has uikit components that must be loaded. $this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp); diff --git a/site/views/look/tmpl/edit.php b/site/views/look/tmpl/edit.php index c6af96e..92ed289 100644 --- a/site/views/look/tmpl/edit.php +++ b/site/views/look/tmpl/edit.php @@ -22,12 +22,9 @@ defined('_JEXEC') or die('Restricted access'); JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tabstate'); -JHtml::_('behavior.calendar'); ?>
toolbar->render(); ?>