3

Hi there I'm trying learn how to rewrite a #id of an exposed filter block (ie. a searchbar filtering a list view. Is there an easy way to do this?

Isn't something that is possible to do with rules?

(i would like to get an answer with an example of how to do the rewrite inc. an example of a syntax as I'm no guru on php or rules either for that matter :)

1 Answer 1

0

To rewrite the ID of the block (if you really want to), you would either use a preprocess function or a custom template file.

Looking at the preprocess function for blocks template_preprocess_block() found here.

https://api.drupal.org/api/drupal/modules!block!block.module/function/template_preprocess_block/7

You can see how the ID is created: $variables['block_id'] and what the theme suggestions are: $variables['theme_hook_suggestions']

You should be able to create a function in you themes template.php as follows:

function mytheme_preprocess_block(&$variables) {
  if ($variables['block_id'] == 'old_id') {
    $variables['block_id'] = 'new_id';
  }
}

However, with a filterblock, there might be some special relationship to the view that might be damaged, I'm not sure, but either way, you do not need to use Rules.

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.