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

Default to an empty array for get_pagination #1782

Merged
merged 2 commits into from
Sep 12, 2018

Conversation

jarednova
Copy link
Member

@jarednova jarednova commented Sep 6, 2018

Ticket: #1758

Issue

If a user is going to call Timber\Pagination\get_pagination they need to do so with an argument, even an empty one

$context['pagination'] = Timber\Pagination::get_pagination( array() );

This is likely because the preferred method is:

$context['pagination'] = new Timber\Pagination(); //works

Solution

This isn't a good solution (even calling \Timber\Pagination directly is generally not recommended). But it was in the starter theme for years this way (and tutorials, etc.) so I think we should make this less preferred method as easy-as-possible.

Impact

None.

Usage Changes

Nope.

Considerations

Ideally consider making Pagination a protected class that can't be called directly. If someone wants pagination they almost certainly want the posts with them. Closing off this external access point in 3.x or something might be the best way to ultimately resolve

Testing

None, but backwards compatibility behavior should be caught by prior tests

@coveralls
Copy link

coveralls commented Sep 6, 2018

Coverage Status

Coverage remained the same at 94.243% when pulling 87bd475 on 1758_pagination_defafult into 112e0b9 on master.

@codecov
Copy link

codecov bot commented Sep 6, 2018

Codecov Report

Merging #1782 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1782   +/-   ##
=========================================
  Coverage     94.83%   94.83%           
  Complexity     1527     1527           
=========================================
  Files            48       48           
  Lines          3585     3585           
=========================================
  Hits           3400     3400           
  Misses          185      185
Impacted Files Coverage Δ Complexity Δ
lib/Pagination.php 100% <100%> (ø) 42 <1> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 112e0b9...87bd475. Read the comment docs.

@jarednova
Copy link
Member Author

Tests passed! I don't anticipate any real fallout from this change, but wanted to make sure others had a look first

Copy link
Member

@gchtr gchtr left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍

@jarednova jarednova merged commit 685bd26 into master Sep 12, 2018
@jarednova jarednova deleted the 1758_pagination_defafult branch September 12, 2018 11:33
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

3 participants