-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[4.0] Cassiopeia: update cardGrey and default chromes to add mod ids to all modules, plus new noTitle chrome #30680
Conversation
This is for modules that generally do not have their header/title displayed, e.g. main menu or search. If used in the module position in the template index.php as "style=noTitle" instead of "style=none" then this will allow a mod id and module class suffix to be added to the modules.
@@ -21,34 +21,22 @@ | |||
} | |||
|
|||
$moduleTag = $params->get('module_tag', 'div'); | |||
$moduleAttribs = []; | |||
$modulePos = $module->position; |
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.
$modulePos = $module->position; | |
$modulePos = $module->position; |
PHPCS: Here we use spaces to indent to alignt the "=" if several assignments in consecutive lines.
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.
This one here, too, please.
<div class="card-body"> | ||
<?php if ($module->showtitle && $headerClass === 'card-title') : ?> | ||
$header = '<div class="card-header'. $headerClass .'"><h3>' . $module->title . '</h3/></div>'; | ||
if ($module->content) : ?> |
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.
This check is not needed. It's already performed on line 18.
$headerClass = htmlspecialchars($params->get('header_class', ''), ENT_QUOTES, 'UTF-8'); | ||
|
||
$header = '<div class="card-header'. $headerClass .'"><h3>' . $module->title . '</h3/></div>'; | ||
if ($module->content) : ?> |
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.
This check is not needed. It's already performed on line 18.
$moduleTag = $params->get('module_tag', 'div'); | ||
$modId = 'mod-' . $module->id; | ||
|
||
if ($module->content) : ?> |
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.
Can you change this check so it's the same as in other layouts?
$modId = 'mod-' . $module->id; | ||
|
||
if ($module->content) : ?> | ||
<div id="<?php echo $modId; ?>" class="<?php echo $modulePos; ?> <?php echo htmlspecialchars($params->get('moduleclass_sfx')); ?>" aria-labelledby="<?php echo $module->title; ?>"> |
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.
Use $moduleTag
instead of div
.
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.
Looks like use of $moduleTag
is missing in other layouts as well.
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.
Use
$moduleTag
instead ofdiv
.
Aren't they the same thing? Edit: Forget that! I see what it is and will try to update it (I've never used anything other than the default 'div')
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.
Use
$moduleTag
instead ofdiv
.
I think the code needs to change like this by adding $moduleTag and $headerTag but removing references to h3 and h4 as I'm not sure what they're there for. It is possible to have h1 or h2 as a header tag.
(Sigh) I can't see how to paste the copied lines in here like others have done, hence the link.
Co-authored-by: Richard Fath <[email protected]>
Co-authored-by: Richard Fath <[email protected]>
Co-authored-by: Richard Fath <[email protected]>
@Scrabble96 I have labelled your PR with two labels and we will take it with priority in the Template working group. As I see that you are new to github and the whole process, may I explain? Reviewers can see violations of the coding standard, for example spaces where the rules require a tab, then the reviewer can edit your code on github and make a suggestion. Reviewers also can write comments if something is not clear as the comments of @SharkyKZ. This means that you should check your code - and in general you will accept the comment and change your code on your own repo. You then can commit your changes and push them. I hope this helps - starting in github is a challenge. You can ping me, if you want, with a mention: write @chmst and I get an e-mail. |
I made a change to cardGrey.php in this branch and committed the changes, but they don't seem to be showing up here. How do I add it to this PR? I see it says 'Pending - Build is running'. Can that be stopped? If the change to cardGrey.php is ok I need to change the other two files as well.
Many thanks. I may well ping you at some point. |
You must then push your commit into the repo. Commit is only locally - it is useful, as you can commit every step of development and add a comment what has been done. Then you push it and it is transferred.
These automatic tests cannot be stopped, they need their time (Joomla is huge). |
Push? I am using github online, not locally. I can't work out GitHub desktop. |
Changed div to $moduleTag Removed h3 and h4
Changed opening div to $moduleTag
Sorry, but I can't make head nor tail of how to push new commits into this PR. I have installed git (git bash?) for Windows 10 and Github desktop. I notice it says at the top that I want to merge 11 commits. But I only made 3 changes, so I don't know what the other 8 are. I might be easier if I delete this PR and just start again with the correct code. Any other suggestions? Humble thanks |
If that is easier for you then do so. But make sure your 4.0-dev branch is up to date with the 4.0-dev branch of the CMS and does not contain any other changes. Then when creating the new branch for the new PR, make sure it is created based on the 4.0-dev branch. This can be done in GitHub desktop by first selecting the 4.0-dev branch as current branch, then creating a new branch, and then select the current 4.0-dev branch and not staging in the choice for the base branch of that new branch. |
I've just found git bash on my desktop, which I see is different from git But all the tutorials I can find only show how to commit to my branch on my own repo only but not how to push them to this PR. |
Closing this PR to start again. |
Pull Request for Issue #30678 .
Summary of Changes
cardGrey and default chromes add the module Id to the header only with a corresponding "aria-labelledby" followed by the same mod Id, e.g. aria-labelledby="mod-16"
If the module header (title) is not shown, then neither is the id and the module outer now contains a different label. e.g. aria-label="module name".
If there was an id for all modules (it won't work where the module position in index.php says "style=none") then these ids could be used for hyperlink anchors, e.g. /mypage#mod-16
Testing Instructions
There is also a NEW chrome, called noTitle.php which can be applied where it is not usual to have a title showing, e.g. the main menu or search module. This can be used as "style=noTitle" in place of "style=none" which will also allow for custom css styling if a module class is added. At the moment, module class is ignored if the style is 'none'.
Actual result BEFORE applying this Pull Request
cardGrey.php and default.php chromes only applied the mod-id to the header (title) so if the header is not shown, then neither is the mod-id.
Expected result AFTER applying this Pull Request
By using the two changed files and using the noTitle chrome instead of none, all modules will have their ids applied, which is useful for link anchors and all modules can have module class suffix applied. On the front end, there is no change to a visitor's view of the site.
Documentation Changes Required
Comments to say that: