Release of v3.2.3
Fix site view form missing classes in J4+. Fix permissions tab in items in J4+. Fix site display controller checkEditId function in J4+. Add class methods to the HtmlView classes in J4+. Fix broken toolbar call in HtmlView in J4+. Fix missing scripts and styles fields and methods in the site admin view model. Update subform field layout across JCB for cleaner look. Remove expansion feature. Fix helper area. Fix database mySql update in J4+. Remove phpspreadsheet completely from Joomla 4+. Add option to use powers in preflight event in the installer class. Fix abstract schema class function check default index warring. Fix dynamicGet so that the table values will load again. #1155. Keep jQuery in dynamicGet area for Joomla 3. Add native plugin builder for Joomla 4 & 5. Add basic API for admin views.
This commit is contained in:
@ -157,6 +157,7 @@ final class Structuremultiple
|
||||
|
||||
$config = [];
|
||||
$checkin = false;
|
||||
$api = null;
|
||||
|
||||
foreach ($this->component->get('admin_views') as $view)
|
||||
{
|
||||
@ -174,8 +175,16 @@ final class Structuremultiple
|
||||
$checkin = true;
|
||||
$this->config->set('add_checkin', $checkin);
|
||||
}
|
||||
|
||||
if (($target = $this->hasApi($view)) > 0)
|
||||
{
|
||||
$this->buildApi($view, $config, $target);
|
||||
$api = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->config->set('add_api', $api);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -265,6 +274,25 @@ final class Structuremultiple
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the view has an API
|
||||
*
|
||||
* @param array $view
|
||||
*
|
||||
* @return int
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private function hasApi(array $view): int
|
||||
{
|
||||
// only for Joomla 4 and above
|
||||
if ($this->config->get('joomla_version', 3) < 4 || !isset($view['add_api']))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int) $view['add_api'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the view is a valid view
|
||||
*
|
||||
@ -333,6 +361,35 @@ final class Structuremultiple
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the api
|
||||
*
|
||||
* @param array $view
|
||||
* @param array $config
|
||||
* @param int $targetArea
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private function buildApi(array $view, array $config, int $targetArea)
|
||||
{
|
||||
$settings = $view['settings'];
|
||||
|
||||
// build the api
|
||||
if ($settings->name_single != 'null' && $targetArea !== 1)
|
||||
{
|
||||
$target = ['api' => $settings->name_single];
|
||||
$this->structure->build($target, 'single', false, $config);
|
||||
}
|
||||
|
||||
// build the list view
|
||||
if ($settings->name_list != 'null' && $targetArea !== 3)
|
||||
{
|
||||
$target = ['api' => $settings->name_list];
|
||||
$this->structure->build($target, 'list', false, $config);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the custom view
|
||||
*
|
||||
|
@ -132,6 +132,12 @@ class Compiler extends Infusion
|
||||
);
|
||||
CFactory::_('Utilities.File')->write($xmlPath, $componentXML);
|
||||
}
|
||||
// remove API
|
||||
if (CFactory::_('Config')->get('add_api') === null)
|
||||
{
|
||||
// first remove the files and folders
|
||||
CFactory::_('Utilities.Folder')->remove(CFactory::_('Utilities.Paths')->component_path . '/api');
|
||||
}
|
||||
|
||||
// Trigger Event: jcb_ce_onBeforeUpdateFiles
|
||||
CFactory::_('Event')->trigger(
|
||||
|
@ -668,6 +668,7 @@ class Infusion extends Interpretation
|
||||
$nameSingleCode
|
||||
)
|
||||
);
|
||||
|
||||
// ADMIN_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
|
||||
CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|ADMIN_VIEW_MODEL_HEADER',
|
||||
CFactory::_('Header')->get(
|
||||
@ -687,6 +688,22 @@ class Infusion extends Interpretation
|
||||
)
|
||||
);
|
||||
|
||||
// API_VIEW_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the controller
|
||||
CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|API_VIEW_CONTROLLER_HEADER',
|
||||
CFactory::_('Header')->get(
|
||||
'api.view.controller',
|
||||
$nameSingleCode
|
||||
)
|
||||
);
|
||||
|
||||
// API_VIEW_JSON_HEADER <<<DYNAMIC>>> add the header details for the controller
|
||||
CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|API_VIEW_JSON_HEADER',
|
||||
CFactory::_('Header')->get(
|
||||
'api.view.json',
|
||||
$nameSingleCode
|
||||
)
|
||||
);
|
||||
|
||||
// JQUERY <<<DYNAMIC>>>
|
||||
CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|JQUERY',
|
||||
$this->setJquery(
|
||||
@ -1028,6 +1045,20 @@ class Infusion extends Interpretation
|
||||
)
|
||||
);
|
||||
|
||||
// API_VIEWS_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the controller
|
||||
CFactory::_('Compiler.Builder.Content.Multi')->set($nameListCode . '|API_VIEWS_CONTROLLER_HEADER',
|
||||
CFactory::_('Header')->get(
|
||||
'api.views.controller', $nameListCode
|
||||
)
|
||||
);
|
||||
|
||||
// API_VIEWS_JSON_HEADER <<<DYNAMIC>>> add the header details for the controller
|
||||
CFactory::_('Compiler.Builder.Content.Multi')->set($nameListCode . '|API_VIEWS_JSON_HEADER',
|
||||
CFactory::_('Header')->get(
|
||||
'api.views.json', $nameListCode
|
||||
)
|
||||
);
|
||||
|
||||
// JQUERY <<<DYNAMIC>>>
|
||||
CFactory::_('Compiler.Builder.Content.Multi')->set($nameListCode . '|JQUERY',
|
||||
$this->setJquery(
|
||||
|
@ -565,6 +565,20 @@ final class Header implements HeaderInterface
|
||||
$headers[] = 'use Joomla\DI\Container;';
|
||||
break;
|
||||
|
||||
case 'api.view.controller':
|
||||
case 'api.views.controller':
|
||||
$headers = [];
|
||||
$headers[] = 'use Joomla\CMS\Factory;';
|
||||
$headers[] = 'use Joomla\CMS\MVC\Controller\ApiController;';
|
||||
break;
|
||||
|
||||
case 'api.view.json':
|
||||
case 'api.views.json':
|
||||
$headers = [];
|
||||
$headers[] = 'use Joomla\CMS\Factory;';
|
||||
$headers[] = 'use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;';
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -565,6 +565,20 @@ final class Header implements HeaderInterface
|
||||
$headers[] = 'use Joomla\DI\Container;';
|
||||
break;
|
||||
|
||||
case 'api.view.controller':
|
||||
case 'api.views.controller':
|
||||
$headers = [];
|
||||
$headers[] = 'use Joomla\CMS\Factory;';
|
||||
$headers[] = 'use Joomla\CMS\MVC\Controller\ApiController;';
|
||||
break;
|
||||
|
||||
case 'api.view.json':
|
||||
case 'api.views.json':
|
||||
$headers = [];
|
||||
$headers[] = 'use Joomla\CMS\Factory;';
|
||||
$headers[] = 'use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;';
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user