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

Improved helper functions #1592

Merged
merged 14 commits into from
Feb 26, 2024
Merged

Improved helper functions #1592

merged 14 commits into from
Feb 26, 2024

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Feb 25, 2024

Adds helper function documentation and adds a few new global helper functions:

  • Add a global asset() helper function
  • Add a global route() helper function
  • Add a global url() helper function

Design notes:

I debated weather these functions should be global or under the Hyde function namespace. I think making them global is the best. For the majority of users, this will be the most convenient, and for a small subset of users where there are conflicts (such as including Hyde in a Laravel application (which is not "officially" supported)), we can add a constant to disable these functions in case of function registration race conditions. TLDR: I think the small conflict risk is worth the major convenience of global functions.

Compatibility mode:

To disable the new global functions, define a constant called HYDE_COMPATIBILITY_MODE and set it to true, and the new functions will not be registered. The constant should be defined early on, for example in a bootstrap file.

@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 18:32 — with GitHub Actions Inactive
Copy link

codecov bot commented Feb 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (de2f20e) to head (ffd7557).

Additional details and impacted files
@@              Coverage Diff              @@
##              master     #1592     +/-   ##
=============================================
  Coverage     100.00%   100.00%             
- Complexity      1748      3496   +1748     
=============================================
  Files            180       360    +180     
  Lines           4727      9460   +4733     
=============================================
+ Hits            4727      9460   +4733     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 19:51 — with GitHub Actions Inactive
@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 19:51 — with GitHub Actions Inactive
@caendesilva caendesilva force-pushed the improved-helper-functions branch from 82d3863 to 08cc208 Compare February 25, 2024 20:09
@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 20:09 — with GitHub Actions Inactive
@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 20:10 — with GitHub Actions Inactive
@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 20:36 — with GitHub Actions Inactive
@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 20:40 — with GitHub Actions Inactive
@caendesilva caendesilva force-pushed the improved-helper-functions branch from b405809 to cca1aee Compare February 25, 2024 20:43
@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 20:43 — with GitHub Actions Inactive
@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 25, 2024 21:25 — with GitHub Actions Inactive
@caendesilva caendesilva temporarily deployed to pr-documentation-1592 February 26, 2024 06:36 — with GitHub Actions Inactive
@caendesilva caendesilva marked this pull request as ready for review February 26, 2024 06:37
@caendesilva caendesilva merged commit 34ca9e4 into master Feb 26, 2024
20 checks passed
@caendesilva caendesilva deleted the improved-helper-functions branch February 26, 2024 10:21
@caendesilva
Copy link
Member Author

Reminder to people reading this: HYDE_COMPATIBILITY_MODE must be defined before the autoloader is required.

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.

1 participant