Skip to content

Commit

Permalink
Frontend HMenü abschaltbar (#985)
Browse files Browse the repository at this point in the history
* Frontend HMenü abschaltbar
  • Loading branch information
hhunderter authored Jun 20, 2024
1 parent edb0392 commit 76d4497
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions application/libraries/Ilch/Layout/Helper/Hmenu/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public function add(string $key, $value = ''): Model
*/
public function __toString()
{
if (empty($this->layout->getConfigKey('showbreadcrumb'))) {
return '';
}

if (empty($this->data)) {
return '';
}
Expand Down
10 changes: 9 additions & 1 deletion application/modules/admin/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ public function install()
->set('multilingual_acp', '0')
->set('custom_css', '')
->set('emailBlacklist', '')
->set('disable_purifier', '0');
->set('disable_purifier', '0')
->set('page_title_order', '%%moduledata%% | %%title%%')
->set('page_title_moduledata_separator', ' | ')
->set('page_title_moduledata_order', '0')
->set('showbreadcrumb', '1');
}

public function getInstallSql(): string
Expand Down Expand Up @@ -985,6 +989,10 @@ public function getUpdate(string $installedVersion): string
unlink(ROOT_PATH . '/static/js/jscolor/hv.png');
unlink(ROOT_PATH . '/static/js/jscolor/jscolor.js');
break;
case "2.2.0":
$databaseConfig = new \Ilch\Config\Database($this->db());
$databaseConfig->set('showbreadcrumb', '1');
break;
}

return 'Update function executed.';
Expand Down
7 changes: 5 additions & 2 deletions application/modules/admin/controllers/admin/Layouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public function settingsAction()
'pageTitleOrder' => 'required',
'pageTitleModuledataSeparator' => 'required',
'pageTitleModuledataOrder' => 'required|numeric|min:0|max:1',
'showbreadcrumb' => 'required|numeric|min:0|max:1',
]);

if ($validation->isValid()) {
Expand All @@ -233,7 +234,8 @@ public function settingsAction()
->set('page_title_moduledata_separator', $this->getRequest()->getPost('pageTitleModuledataSeparator'))
->set('page_title_moduledata_order', $this->getRequest()->getPost('pageTitleModuledataOrder'))
->set('keywords', $this->getRequest()->getPost('keywords'))
->set('description', $this->getRequest()->getPost('description'));
->set('description', $this->getRequest()->getPost('description'))
->set('showbreadcrumb', $this->getRequest()->getPost('showbreadcrumb'));

$this->redirect()
->withMessage('saveSuccess')
Expand All @@ -254,7 +256,8 @@ public function settingsAction()
->set('pageTitleModuledataSeparator', $this->getConfig()->get('page_title_moduledata_separator') ?? ' | ')
->set('pageTitleModuledataOrder', $this->getConfig()->get('page_title_moduledata_order') ?? '0')
->set('keywords', $this->getConfig()->get('keywords'))
->set('description', $this->getConfig()->get('description'));
->set('description', $this->getConfig()->get('description'))
->set('showbreadcrumb', $this->getRequest()->getPost('showbreadcrumb') ?? '1');
}

public function advSettingsAction()
Expand Down
1 change: 1 addition & 0 deletions application/modules/admin/translations/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
'pageTitleModuledataSeparator' => 'Moduldaten Trenner',
'pageContent' => 'Inhalt',
'startPage' => 'Startseite',
'showbreadcrumb' => 'Horizontales Menü anzeigen',
'locale' => 'Standard Seiten Sprache',
'pages' => 'Seiten',
'menuTitle' => 'Menütitel',
Expand Down
1 change: 1 addition & 0 deletions application/modules/admin/translations/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
'pageTitleModuledataSeparator' => 'Module data separator',
'pageContent' => 'Content',
'startPage' => 'Startpage',
'showbreadcrumb' => 'Show horizontal menu',
'locale' => 'Standard page locale',
'pages' => 'Pages',
'menuTitle' => 'Menutitle',
Expand Down
15 changes: 15 additions & 0 deletions application/modules/admin/views/admin/layouts/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ class="form-control"
name="description"><?=$this->escape($this->originalInput('description', $this->get('description'))) ?></textarea>
</div>
</div>

<div class="row mb-3<?=$this->validation()->hasError('showbreadcrumb') ? ' has-error' : '' ?>">
<label for="showbreadcrumb" class="col-xl-2 col-form-label">
<?=$this->getTrans('showbreadcrumb') ?>:
</label>
<div class="col-xl-4">
<div class="flipswitch">
<input type="radio" class="flipswitch-input" id="showbreadcrumb-yes" name="showbreadcrumb" value="1" <?=($this->originalInput('showbreadcrumb', $this->get('showbreadcrumb'))) ? 'checked="checked"' : '' ?> />
<label for="showbreadcrumb-yes" class="flipswitch-label flipswitch-label-on"><?=$this->getTrans('on') ?></label>
<input type="radio" class="flipswitch-input" id="showbreadcrumb-no" name="showbreadcrumb" value="0" <?=(!$this->originalInput('showbreadcrumb', $this->get('showbreadcrumb'))) ? 'checked="checked"' : '' ?> />
<label for="showbreadcrumb-no" class="flipswitch-label flipswitch-label-off"><?=$this->getTrans('off') ?></label>
<span class="flipswitch-selection"></span>
</div>
</div>
</div>
<?=$this->getSaveBar() ?>
</form>

Expand Down

0 comments on commit 76d4497

Please sign in to comment.