Submitted by Jonathan Henson (not verified) on Wednesday, March 17th, 2010.
First off, thank you for a great starter theme. I am fairly new to Drupal so my question might be a bit newbie :D I’m trying to make a few changes to the comment form. I’ve searched extensively and haven’t found a solution that works. What I’m trying to do is change the way the default name field is filled. I’ve made the field required, and would like to remove the autofill of Guest so that anonymous users must enter their name, or at least enter something. I would also like to remove the homepage field. I’ve looked in the template.php and found this
/** * Override or insert variables into the comment templates. * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered. */ / function harbormoontheme_preprocess_comment(&$vars, $hook) { $vars['sample_variable'] = t('Lorem ipsum.'); } */
I think I understand the $vars, but I can’t figure out what to put for $hook. Could you give a quick example of what to enter to change the name field?
Submitted by Jeff Burnz on Wednesday, August 25th, 2010.
You don’t have to put anything, you can if you want to (like use a switch statement) but you don’t have to do that - so you can just define variables without having to think about the hook (in your example “comment” is the hook). You can do all the pre-processing stuff inside themename_preprocess() with a big switch statement (switch hooks) if you really want to. Sorry for the slow reply - somehow this comment go overlooked for a long time!
Comments
#1 Changing the comment form
First off, thank you for a great starter theme. I am fairly new to Drupal so my question might be a bit newbie :D I’m trying to make a few changes to the comment form. I’ve searched extensively and haven’t found a solution that works. What I’m trying to do is change the way the default name field is filled. I’ve made the field required, and would like to remove the autofill of Guest so that anonymous users must enter their name, or at least enter something. I would also like to remove the homepage field. I’ve looked in the template.php and found this
/**
* Override or insert variables into the comment templates.
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered.
*/
/
function harbormoontheme_preprocess_comment(&$vars, $hook) {
$vars['sample_variable'] = t('Lorem ipsum.');
}
*/
I think I understand the $vars, but I can’t figure out what to put for $hook. Could you give a quick example of what to enter to change the name field?
Thanks again.
#2 ...
You don’t have to put anything, you can if you want to (like use a switch statement) but you don’t have to do that - so you can just define variables without having to think about the hook (in your example “comment” is the hook). You can do all the pre-processing stuff inside themename_preprocess() with a big switch statement (switch hooks) if you really want to. Sorry for the slow reply - somehow this comment go overlooked for a long time!
Post new comment