open_social
open_social copied to clipboard
Issue #3281598 by nkoporec: Unable to show event default menu local tasks on a custom subpage
Problem
I want to create a subpage on /node/{id)/page , that renders a form. As part of the requirements, this page should include all menu local tasks that are currently present on /node/{id} page.
Currently, there is no way to show links like 'Enrollments', 'Manage enrollments', 'Organisers'. The reason for this is because we programmatically remove this menu links via hook_menu_local_tasks_alter() for all pages except certain ones, which are hard coded inside an array.
Solution
We need to provide a way to alter this hard coded list of routes where this special event menu local tasks are shown. The most straightforward way is to create a new hook, where user will be able to alter this array.
Issue tracker
https://www.drupal.org/project/social/issues/3281598
Theme issue tracker
[Required if applicable] Paste a link to the drupal.org theme issue queue item, either from socialbase or socialblue. If any other issue trackers were used, include links to those too.
How to test
- Create a new form, with route /node/{node}/page
- Create a new menu local task for this route that shows up on entity.node.canonical page
- Go to an event, you should be able to see your new local task and also other ones, such as 'Enrollments'
- Go to this new route and check the local task.
- You will not see local tasks such as 'Enrollments', 'Manage enrollments', 'Organisers'
Definition of done
Before merge
- [ ] Code/peer review is completed
- [ ] All commit messages are clear and clean. If applicable a rebase was performed
- [ ] All automated tests are green
- [ ] Functional/manual tests of the acceptance criteria are approved
- [ ] All acceptance criteria were met
- [ ] If applicable (I.E. new hook_updates) the update path from previous versions (major and minor versions) are tested
- [ ] This pull request has all required labels (team/type/priority)
- [ ] This pull request has a milestone
- [ ] This pull request has an assignee (if applicable)
- [ ] Any front end changes are tested on all major browsers
- [ ] New UI elements, or changes on UI elements are approved by the design team
- [ ] New features, or feature changes are approved by the product owner
After merge
- [ ] Code is tested on all branches that it has been cherry-picked
- [ ] Update hook number might need adjustment, make sure they have the correct order
- [ ] The Drupal.org ticket(s) are updated according to this pull request status
Screenshots
Before:
After:
Release notes
Added a new hook hook_social_event_menu_local_tasks_routes_alter()
, it adds ability to alter the routes on which special event menu local task links are displayed.
Change Record
[Required if applicable] If this Pull Request changes the way that developers should do things or introduces a new API for developers then a change record to document this is needed. Please provide a draft for a change record or a link to an unpublished change record below. Existing change records can be consulted as example. Please provide a draft for a change record or a link to an unpublished change record below. Existing change records can be consulted as example.
Translations
[Optional]Translatable strings are always extracted from the latest development branch. To ensure translations remain available for platforms running older versions of Open Social the original string should be added to translations.php
when it's changed or removed.
- [ ] Changed or removed source strings are added to the
translations.php
file.
@nkoporec Please rebase this PR.
@nkoporec Also, add/update required labels on this PR.
@nkoporec Please, see comments from Navneet above.