Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is it possible to use "page title" as field in Views?
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#21 | page-title-title.png | 65.5 KB | greg.harvey |
#15 | 595700-page_title_views_field-3.patch | 5.27 KB | greg.harvey |
#11 | 595700-page_title_views_field-2.patch | 5.43 KB | greg.harvey |
#8 | 595700-page_title_views_field.patch | 5.15 KB | greg.harvey |
Comments
Comment #1
ranavaibhav1+ This will be helpful feature
Comment #2
nicholasThompsonReally? Could someone explain a use-case where you'd want to list node's by their Page Title rather than their Node Title?
Comment #3
dicreat CreditAttribution: dicreat commentedFor example, page title can be used as an additional short teaser for node. When you build a block with short titles it's really helpful feature.
Comment #4
greg.harveyOk, +1 here...
Example - my client is using Page Title to allow shorter breadcrumb (via Custom Breadcrumbs) and page titles but still allow long rambling ones in their News section - here's an example:
http://www.economistconferences.co.uk/news/risk-summit-dan-gardner-impor...
The token allows this to work with Custom Breadcrumbs, which is great. Trouble is, we still have the long rambling ones on the News main page, but we'd like to use the shorter ones:
http://www.economistconferences.co.uk/news
So Page Title as a Views field would be really useful. I'll probably end up writing this in the next couple of months, if someone doesn't beat me to it. Naturally, I'll post back if I do.
Comment #5
srobert72 CreditAttribution: srobert72 commentedSubscribe
Comment #6
FiNeX CreditAttribution: FiNeX commentedIt could be useful even from an admin point of view.
Comment #7
ptitb CreditAttribution: ptitb commentedCould be useful indeed. I would like to use it to export a Word doc with all nodes with the pagetitle and nodewords included.
As a content overview document to use when rewriting texts and as SEO document/handout.
Comment #8
greg.harveyAt last, patch for review! Adds a new field handler for Page Title, including an option to fall back on to the node title if the Page Title is not populated. Also provides a filter and an argument, using the node handlers provided by the Views module.
Edit: In case you saw previous edits, ignore, use this patch, it's fine.
Comment #9
greg.harveyOutput works in 'preview' of views admin but breaks when it outputs the mark-up. New patch to follow.
Comment #10
greg.harveyI take that back, it works great. My theme templates were at fault. Please use #8 and test away!
Comment #11
greg.harveyNew patch, just tidying up after this review via matason on IRC:
No functional difference, just tidier code against the dev snapshot.
Comment #12
matason CreditAttribution: matason commentedLooks like the paths in the second patch file header are absolute?
Comment #13
matason CreditAttribution: matason commentedAh okay, -p to the rescue - the patch applies cleanly if you place it in the page_title module directory and run:
Good work @gregharvey, looks good and works well!
As an aside, I was also getting the "warning: Invalid argument supplied for foreach() in page_title.module on line 956." while testing which is a separate issue at http://drupal.org/node/818194 - I'll knock up a quick patch for that.
Comment #14
greg.harveyBugger, forgot to tidy up the paths. Sorry. Thanks for testing! =)
Comment #15
greg.harveyPaths fixed, to make it easier for the maintainer to apply the patch. Should apply cleanly without any patch gymnastics with this one. No code change since R&TBC, so no need to re-review.
Comment #16
dicreat CreditAttribution: dicreat commentedI have strange error after applying patch and flushing cache: PHP Fatal error: Cannot redeclare page_title_views_api() (previously declared in /sites/all/modules/page_title/page_title.module:587)
in /sites/all/modules/page_title/page_title.module on line 585"
In page_title.module all seems to be fine:
Hmm...
Comment #17
nicholasThompsonCommitted to DRUPAL-6--2, Just need to port it to 7.x and 5.x...
I also added a default admin view which lists all the node page titles. Can be found under the admin > reports section of the site.
Thanks to everyone for this patch - particularly Greg and Matason. I love the Drupal community :-)
Comment #18
tyler-durden CreditAttribution: tyler-durden commentedSorry, I just stumbled upon this and installed it but can't get it working. I upgraded from the stable 6.2.3 to the 6.x-2.x-dev dated 8/26/10. What should I see different, as I don't see any new field in my views admin? Thanks for any clarification.
Comment #19
greg.harveyYou should see a new field in your Views admin. Have you cleared all caches, including the Views cache (see Views Tools menu)?
Comment #20
tyler-durden CreditAttribution: tyler-durden commentedI have cleared all cache including the views cache and do not see it. I am using "Views 6.x.2.10", is the supported Views? I do not see inthis thread which Views version is supported with this.
Also there is a "Page Title Views SimpleTest" module, I have enabled this but do not see anything. What is this supposed to do? Thanks!
Comment #21
greg.harveyAny Views 2.x is fine. SimpleTest is just for testing changes, you don't need it.
That is very strange. You should see a Page Title field like the one in the PNG attached. The code is there in the dev snapshot.
Comment #22
tyler-durden CreditAttribution: tyler-durden commentedHot dang now I am excited! I was looking for the field to already be on the Pages which I already had created, but now I see you need to create a new display. This is going to rock, how stable is it to use ??
Comment #23
greg.harvey100% stable.
Edit: That bit anyway - I'm not vouching for the entire dev snapshot, but the view handlers are fine. There's a filter and a sort too.
Comment #24
tyler-durden CreditAttribution: tyler-durden commentedSweet, thanks! I'll do some heavy testing before using it...
Comment #25
Shadlington CreditAttribution: Shadlington commentedSubbing
Comment #26
andypostViews 3 now have pluggable display extenders #681468: Create pluggable display extenders
Suppose page_title should implement it's own extender and discard current implementation of own display type