Skip to content

2.x images api#2342

Merged
gchtr merged 4 commits into2.xfrom
2.x-images-api
Oct 18, 2020
Merged

2.x images api#2342
gchtr merged 4 commits into2.xfrom
2.x-images-api

Conversation

@acobster
Copy link
Copy Markdown
Collaborator

Ticket: #2333

Issue

Discussed in detail in the linked issue and in #2316 .

Solution

Aliases and docs for ::get_image() and ::get_attachment() and corresponding Twig functions.

Impact

A slightly bigger but less confusing API.

Usage Changes

MOAR METHODS

Considerations

We threw out the idea of adding ::get_images() and ::get_attachments() (plural) for consistency. I don't see as strong a reason to have these in there, and they're potentially even more confusing because of the potential for getting back a mixed bag of concrete classes.

Testing

Yes, test all the things!

These are just aliases of ::get_post(). See also discussion in #2316, specifically:

#2316 (review)
@coveralls
Copy link
Copy Markdown

coveralls commented Oct 15, 2020

Coverage Status

Coverage increased (+0.5%) to 87.426% when pulling 30a3535 on 2.x-images-api into f036e42 on 2.x.

Copy link
Copy Markdown
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.

I see your concerns with having these aliases and had an idea that I wanted to run by you (see suggestion).

@acobster
Copy link
Copy Markdown
Collaborator Author

@gchtr I like it - nice and simple, and less surprising. @jarednova what do you think?

acobster added a commit that referenced this pull request Oct 16, 2020
2.x factories

NOTE: THIS DOES NOT CONTAIN UP TO DATE DOCS ABOUT THE NEW API

The 2.x-docs-api API branch (PR #2073) is where overall API changes for 2.x are being tracked and discussed. At time of writing these are the tasks remaining before the 2.0 API/docs are production-ready:

* Deprecate Timber\PostClassMap filter and rename it to timber/post/classmap. Currently, it’s called timber/post/post_class in the 2.x branch. #2293
* Determine what happens when a timber/*/classmap filter callback returns something other than a CoreInterface. (Probably should throw an exception rather than just letting it TypeError.) - also #2293
* Finalize type declarations #1863
* Implement the new PagesMenu API. #2292
* Implement ::get_image() and ::get_attachment() top-level methods and corresponding Twig functions. #2333 #2342
Base automatically changed from 2.x-factories to 2.x October 16, 2020 17:04
jarednova
jarednova previously approved these changes Oct 16, 2020
Copy link
Copy Markdown
Member

@jarednova jarednova left a comment

Choose a reason for hiding this comment

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

This looks good @acobster! This is approved once you're able to resolve @gchtr's suggestion. I left my comments specifically on that proposed change

@acobster
Copy link
Copy Markdown
Collaborator Author

@gchtr please see updates :)

Copy link
Copy Markdown
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! 👍

@gchtr gchtr merged commit 5c974f3 into 2.x Oct 18, 2020
@gchtr gchtr deleted the 2.x-images-api branch October 18, 2020 08:54
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.

4 participants