When you go to add a Content Item widget, the Live Preview shows a node even before you've selected one. It appears to be whatever is the earliest node ID of the content type that is first in alphabetical order. This is unlikely to be the one you want, particularly if you have created your own content types.

It would be less confusing to show no preview at all until you have selected a node in the Piece of Content autocomplete field.

Comments

dsnopek’s picture

I agree, it would be better to not show anything before an item is selected. However, I'm not exactly sure how to do this in Views (which is how the widget is implemented).

We can't just make the 'Piece of content' filter required because we only use that in the settings form - on saving we clear out that filter and set the 'Nid' filter. So, setting to required makes the settings form work how we want, but breaks actual rendering. :-/

We'll probably have to do it with custom code. Lemme see what our options are...

dsnopek’s picture

Status: Active » Needs review
StatusFileSize
new935 bytes

Here's a patch that works in my testing! Please let me know what you think.

dsnopek’s picture

Status: Needs review » Needs work

Hrm. So, this patch is fixing this issue! But I'm noticing that there's lots of PHP notices if you save a "Content item" without a "Piece of content" set at all. We should probably make the 'title' filter required on the settings form (but not in the View for the reasons mentioned above) to prevent users from saving such widgets.

I tried setting $exposed['filter-title']['title']['#required'] = TRUE in panopoly_widgets_form_views_content_views_panes_content_type_edit_form_alter() but it had no effect. :-/

dsnopek’s picture

Status: Needs work » Needs review

Ok, it turns out that did make it required, but just didn't show the required marker! This new patch makes title required and shows the marker to make things clear to the user.

dsnopek’s picture

Status: Needs review » Fixed

This passes all the tests! I'm just going to commit. :-)

  • dsnopek committed 79f5a37 on 7.x-1.x
    Update Panopoly Widgets for Issue #2463395 by dsnopek: Content Item...
dsnopek’s picture

StatusFileSize
new1.61 KB

Er, I meant to upload this patch back in #4...

Status: Fixed » Closed (fixed)

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