Got the notice for node types without a body field (and a place to insert such delimiters).

This notice would be very confusing to users for those node types.

Comments

derjochenmeyer’s picture

Status: Needs review » Active

The message is set in modules/node/node.pages.inc:390

    drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication.<span class="no-js"> You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.</span>'));

Attached patch changes the message to:

The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. For content types that display a "Long text and summary" field (such as Body), you can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.

derjochenmeyer’s picture

Status: Active » Needs review
StatusFileSize
new1.08 KB
derjochenmeyer’s picture

StatusFileSize
new1.08 KB

Forgot a space.

derjochenmeyer’s picture

StatusFileSize
new1.09 KB

And a typo :-/

derjochenmeyer’s picture

StatusFileSize
new1.08 KB

Getting there...

derjochenmeyer’s picture

StatusFileSize
new1.11 KB

This should be it...

shyamala’s picture

Status: Active » Needs review

The Patch works!

But we should not display this message when the content type has no 'Long text and summary' or 'Body' field.

derjochenmeyer’s picture

In my oppinion this message is sufficient.

The first part

The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication.

"trimmed" does not only refer to a trimmed body field, but also to other fields that may be displayed or not in $full or $teaser

The second part

For content types that display a "Long text and summary" field (such as Body), you can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.

This is a usefull hint for users.

Its also not easy (as far as I can tell) to check for a "Long text and summary" field in theme_node_preview(). It's not enough to check for $node->body because any other (or multiple fields) can be "Long text and summary".

derjochenmeyer’s picture

Here is a method to check if the content type uses a "Long text and summary" field.

$instances = field_info_instances();
foreach ($instances['node'][$node->type] AS $field) {
  if ($field['widget']['type'] AND $field['widget']['type'] == 'text_textarea_with_summary') {
    // Content Type has "Long text and summary" field.
  }
}

But that would not be enough to determine if the message makes sense. We would also need to check if the node type actually displays the trimmed version of this field in the Teaser view.

I still think the simple message in #6 is sufficient.

10basetom’s picture

I think the "Preview trimmed" post notice should NOT be displayed when these two criteria are met:

1. Field type = Long text (Manage Fields tab)
2. Teaser = UNchecked (Manage Display tab under "Custom Display Settings")

With this setup, the full content is always shown on the main page, so the "<!-- break -->" option is irrelevant in this context. Removing this post notice when it's not relevant = better user experience and less content pushed below the fold.

nagiek’s picture

Is this still active? Been a while...

Anonymous’s picture

This is still an issue. I don't think that changing the message will help users who don't get this though. Maybe it should check to see whether there are any long text with summary fields on the bundle.

nagiek’s picture

That's exactly what it should do.

Anonymous’s picture

Status: Needs review » Needs work

Ok, switching to needs work then.

jenlampton’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Usability

Changing to 8.x since changes need to be done there first.

Also, I'm not sure the "promoted to the main page" remains relevant for many Drupal sites - or in Drupal 8 where /node can be turned off!

Additionally, I don't think we should encourage anyone to use the teaser break (since it won't work) until this issue gets resolved:
#881006: Regression: 'break' tag doesn't work with Filtered HTML

cweagans’s picture

Issue tags: +Needs backport to D7
swentel’s picture

Version: 8.0.x-dev » 7.x-dev
Issue summary: View changes
Issue tags: -Needs backport to D7

Drupal 8 preview doesn't have this problem anymore

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.