This is a follow-up to: #2421569: Allow the title of "Content item" widgets to be overridden

Overriding the title of a "Content item" widget with the "Featured" view mode of Content Pages will show the override title on top, and then the original title below the image.

It should only replace the title where it was originally placed, so in this case below the image, and not include a title at the top.

Here's a screenshot:

Comments

dsnopek’s picture

Status: Active » Needs work
StatusFileSize
new3.16 KB

Here is a patch that fixes the "Featured" view mode, but actually breaks the "Full content" view mode. I have a @todo in the code about how to fix that! This is also going to need new tests to check both those view modes and make sure everything is working as it should (and so I don't break this again).

dsnopek’s picture

Status: Needs work » Needs review
StatusFileSize
new4.58 KB
new33.71 KB

Here is an updated patch that works with all view modes, on both panelized and un-panelized content types. Plus a patch to panopoly_test to actually test that that is true. :-)

dsnopek’s picture

+++ b/panopoly_widgets.module
@@ -464,27 +464,96 @@ function panopoly_widgets_menu_block_tree_alter($tree, $config) {
+ * Rewrites the node title by poisening the node_load() static cache.
+ *
+ # We use this to support overriding the title of 'Content item' widgets.
+ * Unfortunately, we can't hook into a spot between when the View loads the
+ * entity and Panelizer renders it, so we have to use this hack.

Noticed this stray '#' when skimming through the last patch. Here's a new one to fix it!

dsnopek’s picture

StatusFileSize
new4.58 KB

Er, it helps if I actually attach the patch. :-)

dsnopek’s picture

Trying the two latest patches on Travis-CI:

https://travis-ci.org/dsnopek/panopoly/builds/50369281

dsnopek’s picture

StatusFileSize
new5.27 KB

Here is a new version of this patch which works when a Panelizer view mode includes a "Node content" Pane that renders the node in a different view mode. I'll test this one on Travis-CI too in a moment..

EDIT: Travis-CI build for latest patch: https://travis-ci.org/dsnopek/panopoly/builds/50373108

dsnopek’s picture

Here are some re-rolled patches now that some other things have gotten merged.

EDIT: Travis build: https://travis-ci.org/dsnopek/panopoly/builds/50387323

dsnopek’s picture

Status: Needs review » Fixed

Looking good on Travis-CI! Committing.

  • dsnopek committed aaf92ce on 7.x-1.x
    Update Panopoly Widgets and Test for Issue #2424327 by dsnopek:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.