-
-
Couldn't load subscription status.
- Fork 3.7k
[6.1] New backend Joomla! Help page #46355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ceford
wants to merge
18
commits into
joomla:6.1-dev
Choose a base branch
from
ceford:helptoc
base: 6.1-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+581
−423
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c40e2e1
New Joomla! Help page
ceford e900ced
Fixed code style issues
ceford c916c1f
Corrected case in use statement
ceford 4389fed
Added suggested changes and changed menu order.
ceford ce6507b
Changes admin-hlp.js as suggested
ceford 659dc53
Updated javascript and styles.
ceford 981a310
Merge branch '6.1-dev' into helptoc
richard67 2949e75
Moved inline styles to css
ceford 34e85b7
Fixed spacing in admin-help.css
ceford 1f91630
Set build helpurl minor version to 0. Fixed css syntax.
ceford 2914721
Revert changes helpurl minor version.
ceford c866a7f
Updated frame title, created help/en-GB/index.html.
ceford b3e8657
Adjusted padding-inline-end of item links.
ceford 523c037
Set css margin before color.
ceford 007b0bb
Removed class from toc-build.php, revised js and css.
ceford 50990d3
Fixed style and javascript problems.
ceford 9872cee
Fix css and move include as suggested.
ceford 92603e9
Trying a new menu build structure.
ceford File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
administrator/components/com_admin/tmpl/help/toc-build.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * @package Joomla.Administrator | ||
| * @subpackage com_admin | ||
| * | ||
| * @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| use Joomla\CMS\Help\Help; | ||
| use Joomla\CMS\Language\Text; | ||
|
|
||
| // phpcs:disable PSR1.Files.SideEffects | ||
| \defined('_JEXEC') or die; | ||
| // phpcs:enable PSR1.Files.SideEffects | ||
|
|
||
| function renderHelpMenu(): string | ||
| { | ||
| include __DIR__ . '/toc-src.php'; | ||
|
|
||
| // Initialise variables used the Help men. | ||
| $tocid = 1000; | ||
| $toclevel = 1; | ||
| $liid = 0; | ||
| $firstpass = true; | ||
|
|
||
| return buildMenu($menu, $tocid, $toclevel, $liid, $firstpass); | ||
| } | ||
|
|
||
| function buildMenu(array &$items, int &$tocid, int &$toclevel, int &$liid, bool $firstpass = false): string | ||
| { | ||
| // don't set a ul on the first pass | ||
| if ($firstpass) { | ||
| $html = ""; | ||
| } else { | ||
| $tocid += 1; | ||
| // Increase the toclevel on entry | ||
| $toclevel += 1; | ||
| if ($toclevel > 1) { | ||
| $collapse = ' mm-collapse'; | ||
| } else { | ||
| $collapse = ''; | ||
| } | ||
| $html = "<ul id=\"collapse{$tocid}\" class=\"collapse-level-1{$collapse}\">\n"; | ||
| } | ||
| foreach ($items as $label => $value) { | ||
| $text = Text::_('COM_ADMIN_HELP_' . $label); | ||
| $lclabel = strtolower(str_replace('_', '-', $label)); | ||
| $liid += 1; | ||
|
|
||
| if (is_array($value)) { | ||
| // This is a folder list item | ||
| $icon = "<span class=\"icon-folder icon-fw\" aria-hidden=\"true\"></span>"; | ||
| $wrap_label = "<span class=\"item-title\">{$text}</span>"; | ||
| $html .= "<li id=\"li{$liid}\" class=\"item parent item-level-{$toclevel}\">"; | ||
| $html .= "<a href=\"#\" class=\"has-arrow\">"; | ||
| $html .= "{$icon}{$wrap_label}</a>\n"; | ||
| if (!empty($value)) { | ||
| // Recursively build sublist. | ||
| $html .= buildMenu($value, $tocid, $toclevel, $liid); | ||
| } | ||
| $html .= "</li>\n"; | ||
| } else { | ||
| // This is an article list item. | ||
| $icon = "<span class=\"icon-file-alt icon-fw\" aria-hidden=\"true\"></span>"; | ||
| // The url is help.joomla.org + $label (the help key). | ||
| $url = Help::createUrl($label); | ||
| $link = "<a data-id=\"{$lclabel}\" href=\"{$url}\" target=\"helpFrame\">{$icon}{$text}</a>\n"; | ||
| $html .= "<li class=\"item item-level-{$toclevel}\">{$link}</li>\n"; | ||
| } | ||
| } | ||
| // don't set a ul on the first pass | ||
| if (!$firstpass) { | ||
| $html .= "</ul>\n"; | ||
| } | ||
| // On return decrease the toclevel | ||
| $toclevel -= 1; | ||
| return $html; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a developer can comment better than me but I would not expect to see functions in a tmpl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I can't remember why I chose not to use the mod_menu code. I will look at that again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remembered: it was setting up the required data that put me off using the mod_menu code. So I propose to leave it as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i still dont think its correct to define a function in a tmpl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. But I am not the developer expert, and I can’t help much now. I have asked in the maintainers team for advice, let’s wait what comes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function should be in the view class. Or better, prepare the data in the view class and just render it in the template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Points accepted. I will see what I can do. Back in a few days!