Skip to content
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

Issue #3471956 by joshua1234511, richardgaunt, fionamorrison23: Enhance Civictheme menu theming system #1303

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

joshua-salsadigital
Copy link
Collaborator

@joshua-salsadigital joshua-salsadigital commented Sep 19, 2024

Checklist before requesting a review

  • I have formatted the subject to include ticket number as Issue #123456 by drupal_org_username: Issue title
  • I have added a link to the issue tracker
  • I have provided information in Changed section about WHY something was done if this was not a normal implementation
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have run new and existing relevant tests locally with my changes, and they passed
  • I have provided screenshots, where applicable

Changed

  1. Moved the menu theming code into a helper.
  2. Added theme settings to define the primary navigations and the footer navigation menus.
  3. Updated the menu name check to check for these theme settings if ($menu_name === 'THEME_SETTING')
  4. Added default value for expected values in this code above.

Screenshots

Screenshot 2024-09-19 at 11 05 12 PM
Screenshot 2024-09-19 at 11 05 21 PM

@joshua-salsadigital joshua-salsadigital added State: Needs review Pull requests needs a review from assigned developers State: Requires more work Pull request was reviewed and reviver(s) asked to work further on the pull request labels Sep 19, 2024
@joshua-salsadigital joshua-salsadigital self-assigned this Sep 19, 2024
@joshua-salsadigital
Copy link
Collaborator Author

@richardgaunt
There is an outstanding issue i notices how do we create dynamic templates.
The menu block are styles as per menu used.
Screenshot 2024-09-19 at 11 07 09 PM
example
https://github.com/civictheme/monorepo-drupal/blob/develop/web/themes/contrib/civictheme/templates/block/block--menu-block--civictheme-primary-navigation.html.twig

we need to add this also. (Will this be a manual step

@richardgaunt
Copy link
Collaborator

@richardgaunt There is an outstanding issue i notices how do we create dynamic templates. The menu block are styles as per menu used. Screenshot 2024-09-19 at 11 07 09 PM example https://github.com/civictheme/monorepo-drupal/blob/develop/web/themes/contrib/civictheme/templates/block/block--menu-block--civictheme-primary-navigation.html.twig

we need to add this also. (Will this be a manual step

@joshua-salsadigital This is a place for theme suggestion / theme hook?

@github-actions github-actions bot added State: CONFLICT and removed State: Needs review Pull requests needs a review from assigned developers labels Oct 2, 2024
@joshua-salsadigital
Copy link
Collaborator Author

@richardgaunt

Preprocess Functions

  • Primary Navigation: civictheme_preprocess_block__menu_block__civictheme_primary_navigation
  • Secondary Navigation: civictheme_preprocess_block__menu_block__civictheme_secondary_navigation

These functions are hardcoded to specific menu names and add classes and other attributes based on the menu's region.

Twig Templates

  • Primary Navigation: block--menu-block--civictheme-primary-navigation.html.twig
  • Secondary Navigation: block--menu-block--civictheme-secondary-navigation.html.twig
    -- As you suggested we can work on with theme suggestion / theme hooks to dynamically select templates based on the menu being used.

Solution

Create generic blocks for primary and secondary menus.
Use theme suggestions or theme hooks to dynamically select templates based on the menu being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
State: CONFLICT State: Requires more work Pull request was reviewed and reviver(s) asked to work further on the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants