Hi all,

I have created a block module which takes in a title, image URL and text. It then wraps and styles that content appropriately and the user can place it on the site. What I need now though, is that the user can create multiple instances of the block and place them all over the site. For instance, if the module I created draws a nice feature box (with the title, image and text styled nicely), then I want the user to be able to create many feature boxes, each with different content, but the same basic layout. Is this possible with Drupal? From what I can see, I can only create 1 instance of my block module as it is.

Thanks!!

Comments

yelvington’s picture

mariacheung’s picture

Thanks for your reply!

I understand that I can create different module blocks using the $delta variable. However does that not have to be static? I want the user to be able to create another module block via the drupal backend. Is that possible? Like in Wordpress, the admin can just keep dropping multiple instances of a widget on the page, giving each different content. From everything I've seen, I haven't seen dynamic use of that $delta variable to let the admin add/delete blocks as they please.

BWPanda’s picture

Take a look at how add1sun did this in Nice Menus: http://drupal.org/project/nice_menus (look for the hook_block implementation in nice_menus.module).

She made a settings page where users can enter the number of Nice Menu blocks they want, then creates that many blocks in hook_block, and each can have different content based on the block settings.

Poieo’s picture

http://drupal.org/project/multiblock will get you multiple instances of the same block, but you won't be able to change the content...