1

On this site in the sidebar i have a views_exposed_form to search. I need this search functionality to show my search results for restricted pages.

  • How do i remove the label 'Search Terms'. Is it possible within template.php with a hook?
  • How do i add a placeholder to the input field?
1
  • You can do this by adding form_alter hook in custom module. Commented Feb 8, 2016 at 10:05

2 Answers 2

2
function views_exposed_form($form, &$form_state) {

if ($info = $handler->exposed_info()) {
          $form['#info']["$type-$id"] = $info;
          /**enter your code here  *****/


        }
/**for place holer**/


if (isset($form['title'])) {
        $form['title'][] = array('#placeholder' => t('Gemeente...'));
}




}
1
  • it's not working? I tried it in template.php
    – meez
    Commented Feb 8, 2016 at 13:27
0

Remove label : In exposed form settings there is a label text if you will not add any value on that it will not display any label

    /* for placeholder */ 

    function hook_form_alter(&$form, &$form_state, $form_id) {
     if ($form_id == 'views_exposed_form') {
                    $form['title']['#attributes']['placeholder'] = t('Place holder');

    }
    }
2
  • above code i placed in template.php but i don't see a placeholder..
    – meez
    Commented Feb 15, 2016 at 12:35
  • Please add your code what you have written in template.php Commented Feb 16, 2016 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.