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

Added view() method to route collections #6568

Merged
merged 8 commits into from
Sep 23, 2022
Merged

Added view() method to route collections #6568

merged 8 commits into from
Sep 23, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Sep 22, 2022

Description
#6525 again.

Added a new method to simplify rendering out views directly through routes. While you could do this with a closure, this is tidier and easier to read when using many of these.

This supports static info pages in sites, like About, Privacy, Terms, etc. It also supports a more view-first workflow, where the view is primary object, and View Cells are used to display the dynamic content.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added 4.3 enhancement PRs that improve existing functionalities labels Sep 22, 2022
Comment on lines 209 to 211
a simple view:
a simple view. These are always treated as GET requests.

.. literalinclude:: routing/020.php
.. literalinclude:: routing/065.php
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the description for Closures.

Copy link
Member

@lonnieezell lonnieezell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine to me. No matter how much I use that types of functions in Javascript, for some reason in PHP I find it not quite as easy to read. It works fine, though.

There is no $to parameter in the view() method.
@kenjis
Copy link
Member Author

kenjis commented Sep 23, 2022

It does not seem to be communicated well. So I committed the fix.
Maybe the commits were unintentional and broken.
The sample code had been changed to something apparently irrelevant. See the screenshot.

And there is no $to parameter, so I also changed it to the second parameter.

Before:
Screenshot 2022-09-23 14 15 52

After:
Screenshot 2022-09-23 14 25 44

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glanced through the changes, all looks good.

@kenjis kenjis merged commit 25c5d8b into 4.3 Sep 23, 2022
@kenjis kenjis deleted the route-view-2 branch September 23, 2022 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.3 enhancement PRs that improve existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants