So I have a custom block that has been created within the module. I have used the drupal API to generate the brand new fields – which works perfectly.
However, I am having an issue regarding multiple instances of the custom block. As I want the blocks to be sandboxed as the custom fields are only related to the block used within the one region.
Now using Multi Block, I can create another instance of that block but the field is exactly the same. What would be the best approach for having one block but whenever its used, its custom fields per block.
case 'live_chat_block' : variable_set('text_variable', $edit['text_body']); break;
Now the idea I had was to add in the “panel page” as variable ID but there might be a better way. Any suggestions would be useful.
Just to expand on what i would like to achieve:
We currently have panel pages implemented and we have built a custom block with custom fields inside that custom block. The requirement is that every block that we drag into one of the panel pages, we would like for them to have unique fields.
Panel Page: 1 Block ID: 123 Custom Field Title: Superman
Panel Page 2: Block ID: 123 Custom Field Title: Batman
Now as you see, the only thing that changes is the panel pages, the block stay the same and the custom fields need to be unique to that panel page and not the block.
Currently, when changing one block, it impacts on all the other blocks as well.
function livechat_block_configure($delta=''){ $form = array(); switch($delta) { case 'live_chat_block' : // checkbox example: $form['text_body'] = array( '#type' => 'textfield', '#title' => t('Enter in Title here'), '#default_value' => variable_get('text_variable', ''), ); break; } return $form; }
Sponsored by SupremePR