When I add a node and show it in the 'full' preview I get the title from the teaser as link.
(The page variable is false and therefore he get this title)
When I edit a node and show it in 'full' preview I get no title.

At the moment I get the title from my own theme_node_preview function.
In my node.tpl.php I add

<?php if (!$page && empty($node->in_preview)): ?>
      <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
    <?php endif; ?>

But I think that is not the right solution.

CommentFileSizeAuthor
#9 1048494.patch655 bytesdroplet

Comments

dejavu_007’s picture

Try this. I hope it works.

 <?php if (!$page || isset($node->preview)): ?>
    <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
  <?php endif; ?>
klaus66’s picture

I think this don't work because always wenn page is false he get the title. And there is the problem. When the full preview is themed then the page variable is false and that is not ok.

I have fix it with <?php if (!$page && empty($node->in_preview)): ?>

But I think there is a release of drupal 7 and I think it is funny that so a basic function don't work.
I cannot understand that nobody should have seen that there is no title in the full preview.

droplet’s picture

Version: 7.0 » 7.x-dev
Component: theme system » node system

absolutely a bug.

dejavu_007’s picture

I think there is another issue too. When a page is previewed in node add/edit it should be functioning like this..
If the page content (text content added) in full view is not equal to trimmed view, then it should show preview of both views. And if both full view content and trimmed view content are equal, it should show only a single preview.
I think the code which implement this is in nod.page.inc.

if ($trimmed != $full) {
    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>'));
    $output .= '<h3>' . t('Preview trimmed version') . '</h3>';
    $output .= $trimmed;
    $output .= '<h3>' . t('Preview full version') . '</h3>';
    $output .= $full;
  }
  else {
    $output .= $full;
  }

The issue in d7 is that, even if page content for full view and trimmed view are same it shows both previews. I suppose the If statement is always true. Somebody please take a look at this.

klaus66’s picture

In my case I do it with my own theme_function. I only want to see the full preview.

<?php
function dogsell_node_preview($variables) {
  
	drupal_add_js(path_to_theme() . '/preview.js');
	
	
	$node = $variables['node'];

  $output = '<div style="display:none;"><div class="preview">';

  $preview_trimmed_version = FALSE;

  //$elements = node_view(clone $node, 'teaser');
  //$trimmed = drupal_render($elements);
  $elements = node_view($node, 'full');
  $full = drupal_render($elements);

  // Do we need to preview trimmed version of post as well as full version?
  /* if ($trimmed != $full) {
    //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>'));
    //$output .= '<h3>' . t('Preview trimmed version') . '</h3>';
    //$output .= $trimmed;
    //$output .= '<h3>' . t('Preview full version') . '</h3>';
    //$output .= $full;
  } */
  
  if (!empty($node->title)) {
    $output .= '<h1 class="title">' . check_plain($node->title) . '</h1>';
  }
  
  $output .= $full;
  
  $output .= "</div></div>\n";

  return $output;
}
?>

And here you see the node comes from the function node_view and when you have a standart template like 'Bartik' the title is rendered in page.tpl.php and not in node.tpl.php

And therefore I think we must change the node.tpl.php to show us the title when node is in preview like so:

  <?php if (!empty($node->in_preview) && $title): ?>
     <h1 class="title"><?php print $title; ?></h1>
    <?php endif; ?>

Or we set the title in the theme_node_preview function

dejavu_007’s picture

Thanks klaus66.
But this issue is with drupal core. I suppose the second issue should be reported as another bug in drupal core.

dejavu_007’s picture

The second issue has been reported here.
http://drupal.org/node/1049584

klaus66’s picture

You are right.

In normal case this statement is always true because $full and $teaser are normal strings and when you have a teaser the title is always an anchor tag and the title of the $full is no anchor tag.

droplet’s picture

Status: Active » Needs review
StatusFileSize
new655 bytes
klaus66’s picture

#9: 1048494.patch queued for re-testing.

klaus66’s picture

OK.

We have al solution that works for our special case.

But the workflow of creating nodes (that includes the preview) is a basic feature of drupal and the core team must eliminate this bug.

droplet’s picture

@klaus66,

Yes, it is a bug and #9 getting it fix, anything else ?

klaus66’s picture

But with this patch you have a title in the full preview but it is the title from the node template with the anchor and the h2 tag.

I think that is not that what we want to see in the full preview.

I think we must add the title in the theme_node_preview function.

droplet’s picture

So what we want to see in "full preview"?? like #5 ? we can't do hard coding there.

anchor is a problem when it is on overlay.

klaus66’s picture

OK

I think the best compromise is to let the patch and then we can look in the template file whether the node is in preview and set the h1 or h2 tag against the view mode.

droplet’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
kscheirer’s picture

Issue tags: -Needs backport to D7

#9: 1048494.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1048494.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Issue summary: View changes
Status: Needs work » Closed (cannot reproduce)
Issue tags: +Bug Smash Initiative

All of the code mentioned here is no longer relevant, and I can't understand the issue to be able to reproduce it. If anyone know what this is about and thinks it's still valid in D9 please re-open with steps to reproduce.