I am trying to programmatically create beans in a custom module using entity_metadata_wrapper. This is creating a bean for each installed theme. (In Drupal 7)
Is there a way I can create only one instance of the bean block?
for example in my database it creates a bean block for
- my subtheme
- omega
- seven
I would like to only create one block/bean for my subtheme. I am then using mymodule_beans_block_info_alter(&$blocks, $theme, $code_blocks) {} to then change region location and other block parameters.
function bean_ctas_enable(){
foreach(bean_ctas_info() as $bean_content){
$bean_ids = array();
$bean = bean_create(array('type' => 'block_cta'));
$bean_wrap = entity_metadata_wrapper('bean', $bean);
$bean_wrap->label->set($bean_content['label']);
$bean_wrap->title->set($bean_content['title']);
$bean_wrap->field_text->set(array(
'value' => ($bean_content['field_text']),
'format' => ('full_html'),
));
$bean_wrap->field_link->set(array(
'url' => ($bean_content['link_url']),
'title' => 'Read More',
));
$bean_wrap->save();
$bean_ids[] = $bean_wrap->bid->value();
//set variable to store bean ids
variable_set('bean_ctas_bean_ids', $bean_ids);
}
}