Ability to override title of page views

prunelle - February 12, 2009 - 14:56
Project:Viewfield
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have a "front-page" content type which is built with (actually) four CCK-viewfield fields and nothing else. Each of them is set to force a default view. When I create a node of that type, with the title "Hello" (nothing else), the title of that node doesn't become "Hello" but the title of the view display (default or page, in my case) chosen for the forced view of the last (higher weight) viewfield of the node. I hope it's clear enough .... In fact, after some tests, I've found the problem appears with the use of a second CCK-viewfield in the definition of the node type. With a unique viewfield, the node title is correct.

Any idea ?

#1

jerdavis - February 20, 2009 - 02:35
Status:active» postponed (maintainer needs more info)

Extremely odd - I'll see if I can reproduce this one. What version of Drupal core and what version of CCK are you using? What version of Views? Are you using the latest development snapshot of viewfield?

Jer

#2

prunelle - February 20, 2009 - 07:39

Great thanks for your answer Jer.

I've just reproduced this behavior with : Drupal 6.9 , CCK 6.x-2.1, Views 6.x-2.x-dev (02/18), and Viewfield 6.x-1.x-dev (02/11). It's very easy to reproduce.

Regards.

#3

osieke - February 27, 2009 - 15:12

Just wanted to chip in on this issue as I've just stumbled on the same behaviour with just 1 viewfield in the content type.

The viewfield seems to override the node title. When I remove the viewfield from the content type, the node title is displayed correctly.

*UPDATE*
If I change the view field to point to the View defaults instead of the page, the node title seems to display correctly. Maybe this can help in tracking down the issue?

#4

Darren Oh - March 6, 2009 - 21:20
Title:Incorrect title of a node which content type has multiple viewfields» Incorrect title of a node which contains page views
Status:postponed (maintainer needs more info)» by design

That is the expected behavior of a page view. Someone might be able to create a patch to make Viewfield restore the previous title every time a view is displayed in a node.

#5

prunelle - March 8, 2009 - 11:16

Yes, but ... How do you expain that when the node contains a unique viewfield with a page view, the original node title is kept, and not replaced by the page view title ? The node title becomes wrong when you add a second viewfield with a page view.

#6

Darren Oh - March 9, 2009 - 15:48

I cannot reproduce that on my site.

#7

prunelle - March 10, 2009 - 15:02

May I ask you to try the following :
- create a content type with two "viewfield" fields
- those two fields has "Force default" and "Use a common default value for all nodes if the user does not override it on the node form" checked (aside, it seems that checking only "Force default" isn't enough to force a default ...)
- the first field content is forced to the default view : tracker, with the page display
- the second one is forced to the default view : archive, with the page display

On my site with all the latest versions (Drupal 6.10 and the last dev versions of CCK, Views and Viewfield), if I create a node of that type, whose title is "Trial". When I view it, the title output is "Monthly archive", and not "Trial" (nor "Recent posts", which would be bad also, anyway).

I'm sorry to insist. I hope you will find where is the trouble.

Thanks for your help.

#8

Darren Oh - March 10, 2009 - 15:14

I understand the problem, but I think it happens even when there is only one page view, if that page view has a title. If you only experience the problem when you add a second page view, the first page view must not have a title.

#9

prunelle - March 10, 2009 - 15:43

Yes, I've just tried, you're right ! It's the same with only one viewfield. Sorry for this confusion.
Thanks for your quick answer.

#10

ksc - March 10, 2009 - 20:27

----title dissapears ------ dev version 2009-march-10
I have a similar problem. (drupal 6.10)
When using viewfield (only one) the page title dissapears and the content is shown to the right side of the menu tabs on top (view .. edit ... outline..). With the dev-version before it was fine!
I tested different options under content type/display fields - no change at all. With all options I get the same display of the view linked by viewfield. Excluding the viewfield under "display views" makes no difference.
Only the choice "hidden" works to get the title shown again.

Oh- I just found out:
-> Content type/edit fields/viewfield/configure: When I chose ´view´-Standard it is ok, when I chose ´view-Page´ the explained problem shows up.

#11

Darren Oh - March 11, 2009 - 13:56
Title:Incorrect title of a node which contains page views» Ability to override title of page views
Category:bug report» feature request
Status:by design» active

Viewfield is not doing this. Page views by definition can set the page title. They think they're providing the whole page.

Creating a workaround would be a good project for a new developer. I explained what needs to be done in comment #4.

#12

Reg - March 31, 2009 - 11:05

I don't think a patch is appropriate as this is really just a hack, but, for those who need a solution as I did here's what I did to quickly resolve this with viewfield/views.

In .../all/modules/views/includes/view.inc I added these lines:

<?php
function get_title() {

       
# ---> all code just before the return statement of this routine <---

        # For the viewfield module so that we can use the page's title and not a view generated title.
       
if (strtolower($title) == 'use_page_title') {
           
$node = node_load(arg(1));
           
$title = $node->title;
        }
        return
$title;
}
?>

Then in my views display instead of putting in a title to use for the page I put in use_page_title.

Hope this helps.

#13

Darren Oh - May 19, 2009 - 16:41

Duplicate issue 459590.

#14

Darren Oh - May 19, 2009 - 17:54
Status:active» needs review

Patch based on ramsalt's code in issue 443592.

AttachmentSize
viewfield.theme_.inc-373373-14.patch 1009 bytes

#15

Darren Oh - May 22, 2009 - 01:22
Status:needs review» fixed

Fixed in CVS commit 214936.

#16

System Message - June 5, 2009 - 01:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.