Update on v1.0.2 (beta for next version)
Here's an update on the current version, which includes changes towards the next release still in beta.
This commit is contained in:
parent
20d78e430a
commit
4a86b860ff
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="plugin" version="4" group="content" method="upgrade">
|
<extension type="plugin" version="3.10" group="content" method="upgrade">
|
||||||
<name>PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS</name>
|
<name>PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS</name>
|
||||||
<creationDate>24th October, 2023</creationDate>
|
<creationDate>2nd March, 2024</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>joomla@vdm.io</authorEmail>
|
<authorEmail>joomla@vdm.io</authorEmail>
|
||||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
// No direct access to this file
|
// No direct access to this file
|
||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||||
|
|
||||||
// import the list field type
|
// import the list field type
|
||||||
jimport('joomla.form.helper');
|
jimport('joomla.form.helper');
|
||||||
JFormHelper::loadFieldClass('list');
|
JFormHelper::loadFieldClass('list');
|
||||||
|
@ -24,7 +28,7 @@ class JFormFieldExcludedlanguages extends JFormFieldList
|
||||||
/**
|
/**
|
||||||
* The excludedlanguages field type.
|
* The excludedlanguages field type.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $type = 'excludedlanguages';
|
public $type = 'excludedlanguages';
|
||||||
|
|
||||||
|
@ -48,7 +52,7 @@ class JFormFieldExcludedlanguages extends JFormFieldList
|
||||||
$script = array();
|
$script = array();
|
||||||
$button_code_name = $this->getAttribute('name');
|
$button_code_name = $this->getAttribute('name');
|
||||||
// get the input from url
|
// get the input from url
|
||||||
$app = JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
$jinput = $app->input;
|
$jinput = $app->input;
|
||||||
// get the view name & id
|
// get the view name & id
|
||||||
$values = $jinput->getArray(array(
|
$values = $jinput->getArray(array(
|
||||||
|
@ -64,7 +68,7 @@ class JFormFieldExcludedlanguages extends JFormFieldList
|
||||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||||
// get the return value.
|
// get the return value.
|
||||||
$_uri = (string) JUri::getInstance();
|
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
|
||||||
$_return = urlencode(base64_encode($_uri));
|
$_return = urlencode(base64_encode($_uri));
|
||||||
// load return value.
|
// load return value.
|
||||||
$ref .= '&return=' . $_return;
|
$ref .= '&return=' . $_return;
|
||||||
|
@ -77,20 +81,20 @@ class JFormFieldExcludedlanguages extends JFormFieldList
|
||||||
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
|
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
|
||||||
$button_label = ucfirst(strtolower($button_label));
|
$button_label = ucfirst(strtolower($button_label));
|
||||||
// get user object
|
// get user object
|
||||||
$user = JFactory::getUser();
|
$user = Factory::getUser();
|
||||||
// only add if user allowed to create language
|
// only add if user allowed to create language
|
||||||
if ($user->authorise('language.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
if ($user->authorise('language.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
|
||||||
{
|
{
|
||||||
// build Create button
|
// build Create button
|
||||||
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.Text::sprintf('PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||||
href="index.php?option=com_componentbuilder&view=language&layout=edit'.$ref.'" >
|
href="index.php?option=com_componentbuilder&view=language&layout=edit'.$ref.'" >
|
||||||
<span class="icon-new icon-white"></span></a>';
|
<span class="icon-new icon-white"></span></a>';
|
||||||
}
|
}
|
||||||
// only add if user allowed to edit language
|
// only add if user allowed to edit language
|
||||||
if ($user->authorise('language.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
if ($user->authorise('language.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
|
||||||
{
|
{
|
||||||
// build edit button
|
// build edit button
|
||||||
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||||
<span class="icon-edit"></span></a>';
|
<span class="icon-edit"></span></a>';
|
||||||
// build script
|
// build script
|
||||||
$script[] = "
|
$script[] = "
|
||||||
|
@ -123,7 +127,7 @@ class JFormFieldExcludedlanguages extends JFormFieldList
|
||||||
if (is_array($button) && count($button) > 0)
|
if (is_array($button) && count($button) > 0)
|
||||||
{
|
{
|
||||||
// Load the needed script.
|
// Load the needed script.
|
||||||
$document = JFactory::getDocument();
|
$document = Factory::getDocument();
|
||||||
$document->addScriptDeclaration(implode(' ',$script));
|
$document->addScriptDeclaration(implode(' ',$script));
|
||||||
// return the button attached to input field.
|
// return the button attached to input field.
|
||||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||||
|
@ -135,7 +139,7 @@ class JFormFieldExcludedlanguages extends JFormFieldList
|
||||||
/**
|
/**
|
||||||
* Method to get a list of options for a list input.
|
* Method to get a list of options for a list input.
|
||||||
*
|
*
|
||||||
* @return array An array of JHtml options.
|
* @return array An array of Html options.
|
||||||
*/
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,11 @@
|
||||||
// No direct access to this file
|
// No direct access to this file
|
||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Filesystem\File;
|
||||||
|
use Joomla\CMS\Filesystem\Folder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content - Componentbuilder Language Tabs script file.
|
* Content - Componentbuilder Language Tabs script file.
|
||||||
*
|
*
|
||||||
|
@ -31,7 +36,7 @@ class plgContentComponentbuilderLanguageTabsInstallerScript
|
||||||
public function preflight($route, $adapter)
|
public function preflight($route, $adapter)
|
||||||
{
|
{
|
||||||
// get application
|
// get application
|
||||||
$app = JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
// the default for both install and update
|
// the default for both install and update
|
||||||
$jversion = new JVersion();
|
$jversion = new JVersion();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user