hello j'aurais besoins d'aide pour adapter mon module d'administration pour j4, j'avance doucement en essayant de comprendre les name space ...
mais je galere
dans ma fonction j'ai
dans module
et dans le template j'ai
j'ai essayer de m'inspiré du module quick icon de la j4 mais pense manquer des subtilités
et les erreurs
des idées ?
Merci
mais je galere
dans ma fonction j'ai
Code PHP:
public static function getIconFromPlugins(Registry $params, CMSApplication $application = null)
{
$key = (string) $params;
$context = (string) $params->get('context', 'mod_quickicon');
PluginHelper::importPlugin('quickicon');
$arrays = (array) $application->triggerEvent(
'onGetIcons',
new QuickIconsEvent('onGetIcons', ['context' => $context])
);
foreach ($arrays as $response)
{
if (!\is_array($response))
{
continue;
}
foreach ($response as $icon)
{
$default = array(
'link' => null,
'image' => null,
'text' => null,
'name' => null,
'linkadd' => null,
'access' => true,
'class' => null,
'group' => 'MOD_QUICKICON',
);
$icon = array_merge($default, $icon);
if (!\is_null($icon['link']) && !\is_null($icon['text']))
{
self::$buttons[$key][] = $icon;
}
}
}
return self::$buttons[$key];
}
Code PHP:
$systme_buttons = modDashboardHelper::getIconFromPlugins($params);
Code PHP:
<?php foreach ($systme_buttons as $sys_buttons) :?>
<?php //echo '<pre>' ,print_r($sys_buttons),'</pre>';?>
<?php foreach ($sys_buttons as $sys_button) :?>
<li id="<?php echo $sys_button['id']; ?>" class="list-group-item">
<a href="<?php echo $sys_button['link']; ?>">
<span class="<?php echo $sys_button['icon_class']; ?>" aria-hidden="true"></span> <span
class="j-links-link"><?php echo $sys_button['text']; ?></span>
</a>
<span class="divider">|</span>
</li>
<?php endforeach; ?>
et les erreurs
Code PHP:
Call to a member function triggerEvent() on null Call stack # Function Location 1 () JROOT\administrator\modules\mod_dashboard\helper.p hp:148 2 modDashboardHelper::getIconFromPlugins() JROOT\administrator\modules\mod_dashboard\mod_dash board.php:31 3 include() JROOT\libraries\src\Dispatcher\ModuleDispatcher.ph p:54 4 Joomla\CMS\Dispatcher\ModuleDispatcher::Joomla\CMS \Dispatcher\{closure}() JROOT\libraries\src\Dispatcher\ModuleDispatcher.ph p:57 5 Joomla\CMS\Dispatcher\ModuleDispatcher->dispatch() JROOT\libraries\src\Helper\ModuleHelper.php:293 6 Joomla\CMS\Helper\ModuleHelper::renderRawModule() JROOT\libraries\src\Helper\ModuleHelper.php:166 7 Joomla\CMS\Helper\ModuleHelper::renderModule() JROOT\administrator\components\com_cpanel\tmpl\cpa nel\default.php:62 8 include() JROOT\libraries\src\MVC\View\HtmlView.php:428 9 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT\libraries\src\MVC\View\HtmlView.php:218 10 Joomla\CMS\MVC\View\HtmlView->display() JROOT\administrator\components\com_cpanel\src\View \Cpanel\HtmlView.php:155 11 Joomla\Component\Cpanel\Administrator\View\Cpanel\ HtmlView->display() JROOT\libraries\src\MVC\Controller\BaseController. php:691 12 Joomla\CMS\MVC\Controller\BaseController->display() JROOT\administrator\components\com_cpanel\src\Cont roller\DisplayController.php:54 13 Joomla\Component\Cpanel\Administrator\Controller\D isplayController->display() JROOT\libraries\src\MVC\Controller\BaseController. php:729 14 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT\libraries\src\Dispatcher\ComponentDispatcher .php:146 15 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT\libraries\src\Component\ComponentHelper.php: 389 16 Joomla\CMS\Component\ComponentHelper::renderCompon ent() JROOT\libraries\src\Application\AdministratorAppli cation.php:136 17 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT\libraries\src\Application\AdministratorAppli cation.php:179 18 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT\libraries\src\Application\CMSApplication.php :231 19 Joomla\CMS\Application\CMSApplication->execute() JROOT\administrator\includes\app.php:63 20 require_once() JROOT\administrator\index.php:36
Merci
Commentaire