0

How can I change the view block ID from block-views-portfolio-view-block to portfolio?

2
  • Why do you want to? If it is for theming, you can append a class to any block using drupal.org/project/block_class Jun 7, 2016 at 14:15
  • No, it's for creating "all in one page" portfolio. Now I have #contact, #about etc., ad #block-views-portfolio-view-block in addition to this doesn't look too good ;) and it is displayed in addres bar
    – rukya
    Jun 8, 2016 at 5:28

2 Answers 2

1

Add this to your theme's template.php file:

function THEME_preprocess_block(&$variables) {
  if ($variables['block_html_id'] == "block-views-portfolio-view-block")
    $variables['block_html_id'] = "portfolio";

}
0
0

An alternative without coding would be to use Token Embed Views, to embed the view in a custom block. You can use something like Block attributes (Drupal 7) to set an id to that block.

Or you could override the Views display output. If you go the the right bottom of the views interface, click Information next to theme you'll see a list of names. You could wrap the contents of the used template (probably views-view.tpl.php) into another div with your id, and save the file in your theme folder. Use the most accurate filename suggested that still applies to all pages (some with built in node id's etc.).

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.