Getting a list of blockthemes

heronog - March 9, 2009 - 16:56
Project:Block Theme
Version:6.x-1.0-beta1
Component:Code
Category:feature request
Priority:normal
Assigned:heronog
Status:needs review
Description

Hi, I have the need to access the list of themes that are defined for blocktheme to integrate it with another module.

What I want is to be able to select which of the blockthemes to use when rendering a custom block. I am not declaring these blocks with hook_block so they can´t be configured with the admin interface.

I have found that the list of themes is generated in the hook_form_alter, which is impossible to reuse for another modules.

I have separated the part of creating the list of blockthemes into a separate function to be able to use it and I have a patch for this.

I hope this is commited as it´s very useful and does not affect the functionality.

thanks!!

AttachmentSize
blocktheme-getblockthemes_function.patch629 bytes

#1

heronog - March 9, 2009 - 17:41
Title:Getting a list of blockthemes » intended use

Hi, I forgot to post the way I intend to use it.

Whith this patch it is possible to get all defined blockthemes with

$blockthemes = module_invoke('blocktheme', 'get_blockthemes');

this variable can used to populate the options of a select list with Forms API like this

$selectlist = array(
  '#type' => 'select',
  '#options' => $blockthemes,
);

Hope this makes it more clear what my intentions are. As I said above, this does not affect functionality

#2

heronog - March 9, 2009 - 17:47
Title:intended use» Getting a list of blockthemes
 
 

Drupal is a registered trademark of Dries Buytaert.