I am trying to find a way to set a label for the edit-query form, inside generated block google_cse. I think some code is needed inside google_cse.module. But i am not shure where exactly...
Any help would be much appreciated.
I am trying to find a way to set a label for the edit-query form, inside generated block google_cse. I think some code is needed inside google_cse.module. But i am not shure where exactly...
Any help would be much appreciated.
Comments
Comment #1
kestes commentedWe need the same for accessibility compliance. Any ideas on how to add one?
Comment #2
kestes commentedI was able to do this by modifying google_cse.module and adding ",'#title'=>'Search Box',"
before:
$form['query'] = array(
'#type' => 'textfield'
'#default_value' => isset($_GET['query']) ? $_GET['query'] : '',
);
after:
$form['query'] = array(
'#type' => 'textfield','#title'=>'Search Box',
'#default_value' => isset($_GET['query']) ? $_GET['query'] : '',
);
You will also want to hide the label through css if you do not want it displayed and are only adding it for accessibility requirements as we are.
Comment #3
mfbTo modify forms, simply implement hook_form_alter() in your own custom module. See http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hoo...
Comment #4
Everett Zufelt commentedProbably the best approach, if you don't want the label to be visible, but to still be accessible to screen-reader users, is to add a title attribute to the field with the name "Search".
Comment #5
attheshow commentedThe fix in #2 above worked for me. The following CSS can also be added into google_cse.css to hide the label for screen reader users:
Comment #6
malcomio commented