Added first changes suggested by @ohrionmartin in vdm-io/Joomla-Component-Builder#126
This commit is contained in:
parent
64390bd418
commit
664e59972f
@ -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**,
|
> (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.)
|
> never making one mistake or taking any coffee break.)
|
||||||
|
|
||||||
+ *Line count*: **16817**
|
+ *Line count*: **16813**
|
||||||
+ *File count*: **156**
|
+ *File count*: **156**
|
||||||
+ *Folder count*: **57**
|
+ *Folder count*: **57**
|
||||||
|
|
||||||
|
@ -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**,
|
> (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.)
|
> never making one mistake or taking any coffee break.)
|
||||||
|
|
||||||
+ *Line count*: **16817**
|
+ *Line count*: **16813**
|
||||||
+ *File count*: **156**
|
+ *File count*: **156**
|
||||||
+ *Folder count*: **57**
|
+ *Folder count*: **57**
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `#__demo_look` (
|
|||||||
`mobile_phone` VARCHAR(64) NOT NULL DEFAULT '',
|
`mobile_phone` VARCHAR(64) NOT NULL DEFAULT '',
|
||||||
`name` VARCHAR(255) NOT NULL DEFAULT '',
|
`name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
`website` 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,
|
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||||
|
@ -332,7 +332,7 @@ class DemoTableLook extends JTable
|
|||||||
$this->alias = $this->name;
|
$this->alias = $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->alias = JApplication::stringURLSafe($this->alias);
|
$this->alias = JApplicationHelper::stringURLSafe($this->alias);
|
||||||
|
|
||||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||||
{
|
{
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||||
JHtml::_('behavior.tooltip');
|
JHtml::_('behavior.formvalidator');
|
||||||
JHtml::_('behavior.formvalidation');
|
|
||||||
JHtml::_('formbehavior.chosen', 'select');
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
JHtml::_('behavior.keepalive');
|
JHtml::_('behavior.keepalive');
|
||||||
$componentParams = $this->params; // will be removed just use $this->params instead
|
$componentParams = $this->params; // will be removed just use $this->params instead
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
// No direct access to this file
|
// No direct access to this file
|
||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
JHtml::_('behavior.tooltip');
|
|
||||||
JHtml::_('behavior.multiselect');
|
JHtml::_('behavior.multiselect');
|
||||||
JHtml::_('dropdown.init');
|
JHtml::_('dropdown.init');
|
||||||
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_DEMO_FILTER_SELECT_ACCESS') . ' -'));
|
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_DEMO_FILTER_SELECT_ACCESS') . ' -'));
|
||||||
|
27
script.php
27
script.php
@ -23,7 +23,8 @@ defined('_JEXEC') or die('Restricted access');
|
|||||||
|
|
||||||
use Joomla\CMS\Filesystem\File;
|
use Joomla\CMS\Filesystem\File;
|
||||||
use Joomla\CMS\Filesystem\Folder;
|
use Joomla\CMS\Filesystem\Folder;
|
||||||
JHTML::_('behavior.modal');
|
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
|
||||||
|
JHTML::_('bootstrap.renderModal');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script File of Demo Component
|
* Script File of Demo Component
|
||||||
@ -35,23 +36,23 @@ class com_demoInstallerScript
|
|||||||
*
|
*
|
||||||
* @param JAdapterInstance $parent The object responsible for running this script
|
* @param JAdapterInstance $parent The object responsible for running this script
|
||||||
*/
|
*/
|
||||||
public function __construct(JAdapterInstance $parent) {}
|
public function __construct(ComponentAdapter $parent) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on installation
|
* 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
|
* @return boolean True on success
|
||||||
*/
|
*/
|
||||||
public function install(JAdapterInstance $parent) {}
|
public function install(ComponentAdapter $parent) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on uninstallation
|
* 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
|
// Get Application object
|
||||||
$app = JFactory::getApplication();
|
$app = JFactory::getApplication();
|
||||||
@ -408,21 +409,21 @@ class com_demoInstallerScript
|
|||||||
/**
|
/**
|
||||||
* Called on update
|
* 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
|
* @return boolean True on success
|
||||||
*/
|
*/
|
||||||
public function update(JAdapterInstance $parent){}
|
public function update(ComponentAdapter $parent){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before any type of action
|
* Called before any type of action
|
||||||
*
|
*
|
||||||
* @param string $type Which action is happening (install|uninstall|discover_install|update)
|
* @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
|
* @return boolean True on success
|
||||||
*/
|
*/
|
||||||
public function preflight($type, JAdapterInstance $parent)
|
public function preflight($type, ComponentAdapter $parent)
|
||||||
{
|
{
|
||||||
// get application
|
// get application
|
||||||
$app = JFactory::getApplication();
|
$app = JFactory::getApplication();
|
||||||
@ -461,11 +462,11 @@ class com_demoInstallerScript
|
|||||||
* Called after any type of action
|
* Called after any type of action
|
||||||
*
|
*
|
||||||
* @param string $type Which action is happening (install|uninstall|discover_install|update)
|
* @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
|
* @return boolean True on success
|
||||||
*/
|
*/
|
||||||
public function postflight($type, JAdapterInstance $parent)
|
public function postflight($type, ComponentAdapter $parent)
|
||||||
{
|
{
|
||||||
// get application
|
// get application
|
||||||
$app = JFactory::getApplication();
|
$app = JFactory::getApplication();
|
||||||
@ -505,7 +506,7 @@ class com_demoInstallerScript
|
|||||||
$db->setQuery($query);
|
$db->setQuery($query);
|
||||||
$allDone = $db->execute();
|
$allDone = $db->execute();
|
||||||
|
|
||||||
// Install the global extenstion params.
|
// Install the global extension params.
|
||||||
$query = $db->getQuery(true);
|
$query = $db->getQuery(true);
|
||||||
// Field to update.
|
// Field to update.
|
||||||
$fields = array(
|
$fields = array(
|
||||||
|
@ -142,14 +142,14 @@ class DemoModelLooking extends JModelItem
|
|||||||
}
|
}
|
||||||
// Load the JEvent Dispatcher
|
// Load the JEvent Dispatcher
|
||||||
JPluginHelper::importPlugin('content');
|
JPluginHelper::importPlugin('content');
|
||||||
$this->_dispatcher = JEventDispatcher::getInstance();
|
$this->_dispatcher = JFactory::getApplication();
|
||||||
// Check if item has params, or pass whole item.
|
// Check if item has params, or pass whole item.
|
||||||
$params = (isset($data->params) && DemoHelper::checkJson($data->params)) ? json_decode($data->params) : $data;
|
$params = (isset($data->params) && DemoHelper::checkJson($data->params)) ? json_decode($data->params) : $data;
|
||||||
// Make sure the content prepare plugins fire on description
|
// Make sure the content prepare plugins fire on description
|
||||||
$_description = new stdClass();
|
$_description = new stdClass();
|
||||||
$_description->text =& $data->description; // value must be in text
|
$_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
|
// 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.
|
// Checking if description has uikit components that must be loaded.
|
||||||
$this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp);
|
$this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp);
|
||||||
|
|
||||||
|
@ -22,12 +22,9 @@
|
|||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||||
JHtml::_('behavior.tooltip');
|
JHtml::_('behavior.formvalidator');
|
||||||
JHtml::_('behavior.formvalidation');
|
|
||||||
JHtml::_('formbehavior.chosen', 'select');
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
JHtml::_('behavior.keepalive');
|
JHtml::_('behavior.keepalive');
|
||||||
JHtml::_('behavior.tabstate');
|
|
||||||
JHtml::_('behavior.calendar');
|
|
||||||
?>
|
?>
|
||||||
<div class="demo-look">
|
<div class="demo-look">
|
||||||
<?php echo $this->toolbar->render(); ?>
|
<?php echo $this->toolbar->render(); ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user