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

CollectionItemGenerator should use a populate class #32

Closed
carbontwelve opened this issue Jan 3, 2017 · 5 comments
Closed

CollectionItemGenerator should use a populate class #32

carbontwelve opened this issue Jan 3, 2017 · 5 comments
Assignees
Milestone

Comments

@carbontwelve
Copy link
Member

The CollectionItemGenerator should pass to the view the current item using a configurable container class. This way a user can define that they want the CollectionItemGenerator to set item equal to a defined class that gets $this->file passed to it.

@carbontwelve carbontwelve added this to the 1.0.5 milestone Jan 3, 2017
@carbontwelve carbontwelve self-assigned this Jan 3, 2017
@carbontwelve
Copy link
Member Author

This seems to be already written in with the ViewFile class, but it's not always used.

@carbontwelve
Copy link
Member Author

I think this functionality is better handled by per site extensions to plates via the League\Plates\Extension\ExtensionInterface

@carbontwelve
Copy link
Member Author

The ViewFile class only seems to be passed to the view once via the pagination generator. Can its functionality not instead be provided by an plates extension?

carbontwelve added a commit that referenced this issue Jan 4, 2017
…tor-item-class

✨ some improvements related to issue #32
@carbontwelve
Copy link
Member Author

The reason for this is because ViewFile was added as part of #30 as a demonstration of what could happen, rather than what should happen - it should have been on it's own branch?

@carbontwelve
Copy link
Member Author

So ViewFile provides blog archive and index pages helpers by wrapping a File class that it references. For example a cateogry page will have an array of ViewFile set as the variable blog_categories_items.

These helpers are not available for singular pages such as about, or even blog post pages. The question now is should these be passed a variable called $item that contains a ViewFile referencing that page - OR - should an extension to plates bring that functionality?

I am choosing to have an extension to plates that brings to the view the exact same functionality that the ViewFile class does to File items. That way each view has access to helper methods such as $this->getDate('d-m-Y') for the current file as well as to collections of files via ViewFile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant