Skip to content

Commit

Permalink
[FEATURE] Move HMENU special userfunc example from TSREF (#43)
Browse files Browse the repository at this point in the history
* [FEATURE] Move HMENU special userfunc example from TSREF
refs TYPO3-Documentation/t3docs-screenshots#151

* [FEATURE] Move HMENU special userfunc example from TSREF
refs TYPO3-Documentation/t3docs-screenshots#151

Co-authored-by: lina.wolf <[email protected]>
  • Loading branch information
linawolf and linawolf authored Jun 29, 2021
1 parent 3fd7570 commit 7f53b3f
Show file tree
Hide file tree
Showing 4 changed files with 770 additions and 403 deletions.
54 changes: 54 additions & 0 deletions Classes/Userfuncs/CustomMenu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

declare(strict_types=1);

namespace T3docs\Examples\Userfuncs;

class CustomMenu
{

public function makeMenuArray(string $content, array $conf) : array
{
return [
[
'title' => 'Contact',
'_OVERRIDE_HREF' => 'index.php?id=10',
'_SUB_MENU' => [
[
'title' => 'Offices',
'_OVERRIDE_HREF' => 'index.php?id=11',
'_OVERRIDE_TARGET' => '_top',
'ITEM_STATE' => 'ACT',
'_SUB_MENU' => [
[
'title' => 'Copenhagen Office',
'_OVERRIDE_HREF' => 'index.php?id=11&officeId=cph',
],
[
'title' => 'Paris Office',
'_OVERRIDE_HREF' => 'index.php?id=11&officeId=paris',
],
[
'title' => 'New York Office',
'_OVERRIDE_HREF' => 'http://www.example.com',
'_OVERRIDE_TARGET' => '_blank',
]
]
],
[
'title' => 'Form',
'_OVERRIDE_HREF' => 'index.php?id=10&cmd=showform',
],
[
'title' => 'Thank you',
'_OVERRIDE_HREF' => 'index.php?id=10&cmd=thankyou',
],
],
],
[
'title' => 'Products',
'_OVERRIDE_HREF' => 'index.php?id=14',
]
];
}
}
16 changes: 16 additions & 0 deletions Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
defined('TYPO3_MODE') or die();

// Declare static TS file
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'examples',
'Configuration/TypoScript/',
'Examples TypoScript'
);

// Declare static TS file
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'examples',
'Configuration/TypoScript/HmenuSpecial/',
'Examples: HMENU special userfunc'
);
29 changes: 29 additions & 0 deletions Configuration/TypoScript/HmenuSpecial/setup.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# ************************
# CUSTOM MENU
# ************************
lib.custommenu = HMENU
lib.custommenu {
special = userfunction
special.userFunc = T3docs\Examples\Userfuncs\CustomMenu->makeMenuArray

1 = TMENU
1.wrap = <ul class="level-1">|</ul>
1.NO = 1
1.NO {
wrapItemAndSub = <li>|</li>
}

2 = TMENU
2.wrap = <ul class="level-2">|</ul>
2.NO = 1
2.NO {
wrapItemAndSub = <li>|</li>
}

3 = TMENU
3.wrap = <ul class="level-3">|</ul>
3.NO = 1
3.NO {
wrapItemAndSub = <li>|</li>
}
}
Loading

0 comments on commit 7f53b3f

Please sign in to comment.