add header for modules configuration page

master
Jean-Christian Paul Denis 2021-11-06 01:40:29 +01:00
parent 44e74e7e05
commit 997096b9bc
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 19 additions and 1 deletions

View File

@ -2,7 +2,9 @@ dev
- [ ] add global config for file size limit
- [ ] add module to check deprecated PHP function
- [ ] add module to check directory structure
- [ ] add module to create full README file
- [ ] write documentation of php class
- add header for modules configuration
0.5 - 2021.11.05
- add settings to disable (hide) modules

View File

@ -200,6 +200,16 @@ abstract class ImproveAction
*/
abstract public function isConfigured(): bool;
/**
* Get action configuration page header
*
* @return string Headers
*/
public function header(): ?string
{
return null;
}
/**
* Get configuraton gui
*

View File

@ -101,16 +101,22 @@ if (!empty($_POST['fix'])) {
}
}
$action = null;
$header = '';
$breadcrumb = [];
if (!empty($_REQUEST['config'])) {
$breadcrumb = [
__('Configure module') => ''
];
if (null !== ($action = $improve->module($_REQUEST['config']))) {
$header = $action->header();
}
}
# display header
echo '<html><head><title>' . __('improve') . '</title>' .
dcPage::jsLoad(dcPage::getPF('improve/js/index.js')) .
$header .
'</head><body>' .
dcPage::breadcrumb(array_merge([
__('Plugins') => '',
@ -132,7 +138,7 @@ if (empty($_REQUEST['config'])) {
if (!empty($_REQUEST['config'])) {
$back_url = $_REQUEST['redir'] ?? $core->adminurl->get('admin.plugin.improve', ['type' => $type]);
if (null !== ($action = $improve->module($_REQUEST['config']))) {
if (null !== $action) {
$redir = $_REQUEST['redir'] ?? $core->adminurl->get('admin.plugin.improve', ['type' => $type, 'config' => $action->id]);
$res = $action->configure($redir);