The "Content item" widget allows you to place a single node on another page. This can be a useful way of reusing content in a limited way!
However, there are a couple of use cases when you may want to set the title:
- When showing fields from the node, you may want to give it some kind of title, like "Featured article"
- Or when showing the full node, you may want to use a different title than the full node, maybe something shorter to fit on a home page
The first use case is simple - we just enable title overrides on the View. The second is a little more complicated because it's actually rendering the node, so we need to inject the overridden title into the node at the correct point.
I'll upload a patch in a moment which does this!
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | panopoly_test-content-item-title-2421569-3.patch | 2.9 KB | dsnopek |
| #1 | panopoly_widgets-content-item-title.patch | 2.09 KB | dsnopek |
Comments
Comment #1
dsnopekAttached is my first pass at a patch!
Comment #2
dsnopekHere is a patch to add tests for this functionality. I'm not sure if any update functions are necessary, I'll try to use the upgrade tests on Travis-CI to find out.
EDIT: Here's the Travis build: https://travis-ci.org/dsnopek/panopoly/builds/50085987
Comment #3
dsnopekNot sure why the old content item test works locally, but fails on Travis! I suspect it has to do with the autocomplete on the "Piece of content" field, so I'm switching the order that the fields are filled in so that focus moves away and the autocomplete is aborted.
EDIT: New build on Travis: https://travis-ci.org/dsnopek/panopoly/builds/50089513
Comment #5
dsnopekThe tests on Travis-CI are looking good! Committed.