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

Reference collection item content as strings #186

Merged
merged 4 commits into from
Mar 2, 2018

Conversation

damiani
Copy link
Contributor

@damiani damiani commented Feb 27, 2018

This PR is inspired by this question, and adds a __toString method to CollectionItem, to return the contents of a collection item—parsed Markdown, for instance—whenever the item is referenced as a string.

This would allow referencing a specific Markdown collection item in a Blade template like this:

@foreach ($notes as $note)
    {!! $note !!}
@endforeach

...instead of needing to reference $note->getContent().


This PR includes some changes to path handling, replacing realpath and getRealPath which don't play nicely with the virtual file system used in our tests.


I'm working simultaneously on addressing the lack of support for getContent() in Blade files (#172) which will also be affected by this change.

@damiani damiani merged commit 8e2c5ec into master Mar 2, 2018
@damiani damiani deleted the kd-reference-collection-item-as-string branch March 18, 2018 20:19
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.

1 participant