Skip to main content

views

How to change / remove Views2 exposed button from Drupal

Posted in

Add this to your template.php file.

  1. function YOUR_THEME_NAME_preprocess_views_exposed_form(&$vars, $hook) { //this is important
  2.  
  3.   // only alter the required form based on id
  4.   if ($vars['form']['#id'] == 'views-exposed-form-where-to-buy-page-1') {
  5.  
  6.     // Change the text on the submit button
  7.     $vars['form']['submit']['#value'] = t('Search');
  8.  
  9.     // Rebuild the rendered version (submit button, rest remains unchanged)
  10.     unset($vars['form']['submit']['#printed']);
  11.     $vars['button'] = drupal_render($vars['form']['submit']);
  12.   }
  13. }

Drupal body value in views template

If you're creating a view and using a custom node type for that view and don't understand why your $body variable doesn't work to display the content of the node it's because the shortcodes aren't loaded in a view template so you must use $node->content['body']['#value']

If you need more help on the topic feel free to add a comment or create a new post on the Forum

Syndicate content