Changed JArrayHelper to use ArrayHelper and added the use namespace to the files needed. Changed JString to use StringHelper and added the use namespace to the files needed. Fixed the spelling mistake of uniqe. Made changes to compiler to accomidate the new pro member feature that added viewsDefaultOrdering options. Fixed the moving of custom fields found in subforms of a plugin or module. Improved the sorting options to correctly map for custom fields and the category field.
This commit is contained in:
@ -13,6 +13,8 @@
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Componentbuilder Layout Model
|
||||
@ -524,7 +526,7 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function getUniqeFields()
|
||||
protected function getUniqueFields()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -583,7 +585,7 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
JArrayHelper::toInteger($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
@ -624,7 +626,7 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
@ -691,8 +693,8 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
return false;
|
||||
}
|
||||
|
||||
// get list of uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
// get list of unique fields
|
||||
$uniqueFields = $this->getUniqueFields();
|
||||
// remove move_copy from array
|
||||
unset($values['move_copy']);
|
||||
|
||||
@ -753,12 +755,12 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
}
|
||||
}
|
||||
|
||||
// update all uniqe fields
|
||||
if (ComponentbuilderHelper::checkArray($uniqeFields))
|
||||
// update all unique fields
|
||||
if (ComponentbuilderHelper::checkArray($uniqueFields))
|
||||
{
|
||||
foreach ($uniqeFields as $uniqeField)
|
||||
foreach ($uniqueFields as $uniqueField)
|
||||
{
|
||||
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
|
||||
$this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1023,16 +1025,16 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
}
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
// Alter the unique field for save as copy
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
if (ComponentbuilderHelper::checkArray($uniqeFields))
|
||||
// Automatic handling of other unique fields
|
||||
$uniqueFields = $this->getUniqueFields();
|
||||
if (ComponentbuilderHelper::checkArray($uniqueFields))
|
||||
{
|
||||
foreach ($uniqeFields as $uniqeField)
|
||||
foreach ($uniqueFields as $uniqueField)
|
||||
{
|
||||
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
|
||||
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1045,7 +1047,7 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a uniqe value.
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
@ -1054,15 +1056,15 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUniqe($field,$value)
|
||||
protected function generateUnique($field,$value)
|
||||
{
|
||||
|
||||
// set field value uniqe
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = JString::increment($value);
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1090,15 +1092,15 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
{
|
||||
foreach($title as $nr => &$_title)
|
||||
{
|
||||
$_title = JString::increment($_title);
|
||||
$_title = StringHelper::increment($_title);
|
||||
}
|
||||
}
|
||||
// Make sure we have a title
|
||||
elseif ($title)
|
||||
{
|
||||
$title = JString::increment($title);
|
||||
$title = StringHelper::increment($title);
|
||||
}
|
||||
$alias = JString::increment($alias, 'dash');
|
||||
$alias = StringHelper::increment($alias, 'dash');
|
||||
}
|
||||
// Check if this is an array of titles
|
||||
if (ComponentbuilderHelper::checkArray($title))
|
||||
|
Reference in New Issue
Block a user