Fixed gh-422 to insure the details tab always gets added if no custom tab names are found. Added the option to run the expantion option without installing the components locally.

This commit is contained in:
2019-06-18 00:00:41 +02:00
parent 2fb4a1ae43
commit 8acbb3b3a4
9 changed files with 61 additions and 17 deletions

View File

@ -35,7 +35,7 @@ class JFormFieldViewtabs extends JFormFieldList
*/
protected function getOptions()
{
// get the input from url
// get the input from url
$jinput = JFactory::getApplication()->input;
// get the view name & id
$fieldsID = $jinput->getInt('id', 0);
@ -77,14 +77,19 @@ class JFormFieldViewtabs extends JFormFieldList
if (isset($item->addtabs) && ComponentbuilderHelper::checkJson($item->addtabs))
{
$items = json_decode($item->addtabs, true);
$nr = 1;
foreach($items as $itemName)
// check if the array has values
if (ComponentbuilderHelper::checkArray($items))
{
$options[] = JHtml::_('select.option', $nr, $itemName['name']);
$nr++;
$nr = 1;
foreach($items as $itemName)
{
$options[] = JHtml::_('select.option', $nr, $itemName['name']);
$nr++;
}
}
}
else
// check if any were loaded
if (!ComponentbuilderHelper::checkArray($options))
{
$options[] = JHtml::_('select.option', 1, JText::_('COM_COMPONENTBUILDER_DETAILS'));
}