2.x Update Timber Object Getter function names in Twig#2170
Closed
gchtr wants to merge 76 commits into2.x-factoriesfrom
Closed
2.x Update Timber Object Getter function names in Twig#2170gchtr wants to merge 76 commits into2.x-factoriesfrom
gchtr wants to merge 76 commits into2.x-factoriesfrom
Conversation
Provide notice for min. WordPress version
2.x Update post.date
…nd will fail about 1% of the time just due to math)
…o 2.x-twig-get-functions # Conflicts: # .travis.yml # lib/Post.php
3 tasks
Member
Author
|
Added as a new pull request in #2178. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket: #2144
Issue
See #2144.
Solution
Timber::get_*functions.Post(), it can either beget_post()orget_posts(), depending on what’s at hand. The same goes forTermandUser.{{ Attachment() }}function as well as deprecated the{{ Image() }}function without replacement, because we can use{{ get_post() }}and{{ get_posts() }}. The Class Maps will handle returning either aTimber\ImageorTimber\Attachment.Impact
A more unified way of interacting with Timber’s API throughout PHP and Twig.
Usage Changes
New function names. Pretty much the same functionality, except for handling singular and multiple objects.
Considerations
Should we add Twig functions for the special-case
Timber::get_*functions, likeTimber::get_user_by()orTimber::get_post_by_slug(). I think, currently we don’t have to do that.Testing
Tests are currently breaking. They will only run without errors as soon as we merge object factories into the
2.xbranch.Todo