Posted by aharown07 on April 5, 2009 at 2:35am
Jump to:
| Project: | Path Filter |
| Version: | 6.x-1.0 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
| Issue tags: | internal url, pathfilter, profile, url |
Issue Summary
I've created a couple of Profile fields. I'm wanting to put some links in the "explanations" that go with them, but the filter doesn't seem to be working there. Is there a way to use it there? Currently I have pathfilter in my full HTML filter, and these explanation fields seem to recognize HTML, but they aren't recognizing "internal.."
Comments
#1
Do you have the filter working in other locations (pages, fields etc)?
#2
Yes, using it successfully in lots of places. Finding it very, very useful.
Not sure why it doesn't work in the profile/registration forms... HTML works in them so I can put links in that way, but the problem is they'll break when the site goes live and move it to a new directory. (Which is the problem pathfilter is solving for me in numerous other places)
There doesn't seem to be any way to tell Drupal what input filter to use for these profile form instructions... so my guess is it's just not using a filter that includes the pathfilter. But no idea how to tell it to use that one. I had pathfilter in my site default for a while and that didn't seem to make any difference.
#3
Pathfilter should work anywhere where you can specify an input filter. The fact is that for profile fields, you can not do that, even though it does let you use html. This a failing of the profile module really, not pathfilter.
#4
I understand. Thx.
Maybe it will work in D7 since it looks like changes to profile are in the wind.
#5
Try this as a fix, it intercepts all forms to see if they have fields starting "profile_" and, for any found, processes the description with pathfilter.
<?php
function yourmodule_form_alter(&$form, $form_state) {
if (module_exists('pathfilter')) {
_yourmodule_process_form($form) ;
}
}
function _yourmodule_process_form(&$element) {
foreach (element_children($element) as $key) {
$elem =& $element[$key] ;
if (strpos($key, 'profile_')===0) {
if ($text = $elem['#description']) {
$elem['#description'] = pathfilter_filter('process', 0, -1, $text) ;
}
} else {
_yourmodule_process_form($elem) ;
}
}
}
?>
You'll need to incorporate it into a module.
#6
Thanks. Will plan to take a look at it one of these days. I do not yet know how to make modules but I've got the necessary documentation... just a matter of grokking it.