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

Improve readability of sidebar templates #2071

Merged

Conversation

IanDelMar
Copy link
Contributor

Description

This PR moves the sidebar active check to the top of the file to increase readability.

Motivation and Context

Returning early reduces complexity and increases readability. In the footerfull case and the statichero case this pattern even save a call to get_theme_mod( 'understrap_container_type' ) if the corresponding sidebar is not active.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (a code change that neither fixes a bug nor adds a feature)
  • Styling (changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc))
  • Development (changes that affect the build system or external dependencies)
  • Documentation (changes that affect existing inline documentation)

Checklist:

  • I pulled my branch from develop.
  • I am submitting my pull request to develop.
  • I have resolved any conflicts merging this pull request would create.
  • I have checked that there aren't other open Pull Requests for the same update/change.
  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • (Optional) My change requires a change to the documentation.
  • (Optional) I have updated the documentation accordingly.
  • (Optional) My change requires a change to the translations.
  • (Optional) I have updated the translations accordingly.
  • composer phpcs has passed locally.
  • composer php-lint has passed locally.
  • composer phpmd has passed locally.
  • composer phpstan has passed locally.
  • I have read the CONTRIBUTING document.

Further comments

It's not immediately apparent in the diff but the actual sidebar code has not changed at all.

@bacoords bacoords added this to the Release 1.3.0 milestone Feb 2, 2023
@bacoords
Copy link
Member

bacoords commented Oct 9, 2023

This is great!

@bacoords bacoords merged commit df7dcca into understrap:develop Oct 9, 2023
@IanDelMar IanDelMar deleted the sidebar-templates-readability branch October 10, 2023 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants