Needs work
Project:
Viewfield
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Jul 2008 at 14:41 UTC
Updated:
27 Aug 2019 at 19:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tanjerine commented+1 on this please.
Comment #2
rhache commentedSame here. It would be nice as an option in the field configuration to show the View Title
Further more, I would recommend also having the option to show/hide view headers, footers & empty text in the viewfield config.
I have changed this to a Feature Request.
Thanks,
Rene
Comment #3
jax commentedWhen view field includes a view it doesn't display the title of the view.
Comment #4
jax commentedAnd here's a patch that conditionally inserts the title within a div. Maybe there are better classes to add, suggestions welcom.
Comment #5
darren ohIssue 377796 applies to this.
Comment #6
wpanssi commentedThis is still active. Viewsfield doesn't show the title of the view. The title of this issue queue is more descriptive than Issue 377796 so I think it's better to post here.
Comment #7
keithm commentedComment #8
keithm commentedHere is a patch that makes the title (if set) available to the theming layer. Then you can simply override theme_viewfield_formatter_default() using the #view_title key to display the title as you wish, for example:
Comment #9
knalstaaf commentedI've applied this patch and the title still wouldn't show. Is that the only thing we should do, apply the patch, or do we have to do something more?
(You lost me at "Then you can simply override theme_viewfield_formatter_default() using "the #view_title key" to display the title as you wish".)
Edit: Ok, figured it out.
This code:
... goes around line 214 in
viewfield.module. Thought that was the actual patch you were describing, sorry. All works now, thanks!Comment #10
knalstaaf commentedLet's make those titles translatable: #1751350: Block titles not translated
Comment #11
nhck commentedI have tried all of those solutions - and the error persits. I selected a block-type view from the list.
Comment #12
Yuri commentedI can't get it to work either.
Comment #13
ambrojio commentedSo two things about the above solutions:
1. I don't see the View's title as #view_title directly inside the #element object. I had to dig around to find it, and eventually settled on:
$view_title = $element['#view']->display_handler->display->handler->view->display_handler->display->display_options['title'];
It's possible that there is another one, but that worked well for me.
2. Don't hack or patch the module! This is a theme function, so you can place it in your template.php file and change "mytheme" to your theme name. Don't forget to clear caches after you do this!
Comment #14
Gussees commentedOK, the patch works and show the 'title' set in View's Display, but when I want to change the 'title' in Views Display, Viewfield module doesn't show the change. The first value of title stayed glued.
That is, the value of title can not be changed. I'm using the modules:
Views 7.x-3.6 UI Views 7.x-3.6 and 7.x-2.0 Viewfield
Someone who can help me !
Comment #15
tobiberlinIn #8 the line to change has to be
Then it works
Comment #16
tobiberlinSorry, my mistake... this would output the title of the display as it is defined for administration page.
But I found another way: use
$view->get_title();:viewfiled.module, line 131 ff.
Additionally you need to use the theming function in your theme's template.php as described in https://www.drupal.org/node/281409#comment-6085354
Comment #17
tobiberlinUpdate: if you overwrite the titles for each display this still not works fine... it take the title of the default/ master display. Little adjusting:
Comment #18
clau_bolson commentedI have a view with a contextual filter content:nid and I use %1 as title, so it displays the node title as title. It is displayed well if I use the view alone. But when using viewfield all I get as title is "%1"
I have tried different combinations of the above. Can anyone tell me how I should rewrite these functions?
Comment #19
megachrizHere is a patch that combines the ideas from #17 and #9 with the following adjustments:
$view->get_title()is assigned to#view_titleeven if it is empty. I saw no good reason to explicitly set the value toNULLif it is empty. The theming layer can then decide for itself what to do with an empty value.check_plain()for security reasons. Not entirely sure if that should happen in this case though as you need to have admin permissions already to edit a view.Room for improvement: make it configurable to:
Comment #20
Anonymous (not verified) commented@MegaChriz's patch (#19) did the job perfectly for me, thanks.
+1 to getting this merged into the module
Comment #21
eloivaque@MegaChriz's patch (#19) did the job perfectly for me, thanks.
Comment #22
drupalgin commentedPatch worked for me.
Comment #23
jerdavisBefore this patch could be merged we'd need to add the configuration option and default it to false. This may also require an update hook to ensure that the configuration option is set correctly for existing sites and to do whatever other updates are required. Merging the patch as-is would result in a significant and likely un-expected behavioral change for existing sites.
I'd also personally like to see the markup moved to a template or theme function that could be overridden rather than hard-coded in the formatter which would be more difficult to alter on a site-by-site basis.
Comment #24
jerdavisComment #25
jerdavis