Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6471935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:16:58+00:00 2026-05-25T06:16:58+00:00

I currently use theme_blocks() in a base theme for Drupal 6, and I have

  • 0

I currently use theme_blocks() in a base theme for Drupal 6, and I have had difficulty converting my theme to Drupal 7 because theme_blocks() is not used in Drupal 7. The below code is a simple implementation of the function and how I currently use it in Drupal 6:

/* Implementation of theme_blocks() */
function theme_blocks($region) {
  var output = '';
  if ($list = block_list($region)) {
    //cycle through all blocks in a region
    foreach ($list as $key => $block) {
      //test each block for a given condition
      if ($block->delta == 1) {
        output = /* make some changes */
      }
      else {
        output = /* theme per usual */
      }
    }
  }

  return $output;
}

So, essentially I was just using theme_blocks() to cycle through all blocks in a region, targeting a specific block, and change up a few things. The problem is that theme_blocks() is not anymore used in Drupal 7.

Is there a way to target specific block/blocks in a given region, and dynamically make changes based on a theme setting in Drupal 7?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:16:59+00:00Added an answer on May 25, 2026 at 6:16 am

    The theme_blocks() theme function (it is not a hook) is not used anymore in Drupal 7. If you need to alter how a block is rendered you need to implement a preprocess function for the block template file (THEMENAME_preprocess_block(); see the documentation for template_preprocess_block()) or use the block.tpl.php template file in your theme.

    Keep in mind that the logic part should go in the preprocess function, and the rendering code should go in the template file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Drupal 7 and Garland theme. The Recent Content block is currently displaying
I have a history in programming, but not much in software development. I'm currently
I currently use AnkhSVN to integrate subversion into Visual Studio. Is there any reason
I currently use: BufferedReader input = new BufferedReader(new FileReader(filename)); Is there a faster way?
I am currently developing some user controls so that I can use them at
Is there a way in Python to list all the currently in-use drive letters
currently i'm trying to use imagick to generate some images without saving them on
Is there any way to use AppleScript (or something else) to query currently running
Are there alternatives to gitosis that are easier to use? I currently run gitosis
I have a common base class from which all my ASMX webservice classes will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.