DrupalBin
Submit Code
About
Recent Posts
Code
Fix for Fix for Code
Fix for Code
Code
Node type whitelist
an axe coach accessories
coach purses married
Fix for de las ghd alturas
de las ghd alturas
Code
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
taxonomy
test
theme
views
more tags
Home
›
Fix for Setting view title when using a custom validator for a taxonomy_content field
Fix for Fix for Setting view title when using a custom validator for a taxonomy_content field
View
Fix
Fixes are not saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
/** * The previous code is the export of a view display which add a argument to filter nodes having a the passed term using name and synonyms * as value for a taxonomy_content field. It works, but the title of the page is the tid returned by the validate_argument_php code and not the term's * name. * Since the view is exported in a custom module created with the features module (see http://drupal.org/project/features), * the following preprocess_page function is used to overrides the title (and head_title). */ function MYMODULE_preprocess_page(&$vars) { if(arg(0) == VIEW_PATH && arg(1) && is_numeric($vars['title'])) { $tid = (int)$vars['title']; $term = taxonomy_get_term($tid); if($term) { $vars['title'] = check_plain($term->name); $vars['head_title'] = str_replace($tid, check_plain($term->name), $vars['head_title']); } } } /** * The module also needs to set it weight to be greater than views' one (10) so its preprocess_page is called after views' one. */ function MYMODULE_install() { db_query("UPDATE {system} SET weight = 11 WHERE name = 'MYMODULE'"); }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp phps
.