Skip to content

Instantly share code, notes, and snippets.

@DuaelFr
Created October 21, 2016 14:14
Show Gist options
  • Save DuaelFr/550102abeb1d73e7f84f04e1b1348098 to your computer and use it in GitHub Desktop.
Save DuaelFr/550102abeb1d73e7f84f04e1b1348098 to your computer and use it in GitHub Desktop.
Bean creation on install
/**
* Implements hook_install().
*/
function my_module_install() {
$bean = bean_create(array('type' => 'simple'));
$bean->label = 'Mon bloc simple custom';
$bean->title = '';
$bean->delta = 'my-delta';
$bean->field_content = array(
LANGUAGE_NONE => array(
0 => array(
'value' => '<p>Valeur de base qui pourra être administrée après</p>',
'format' => 'full_html',
'safe_value' => '<p>Valeur de base qui pourra être administrée après</p>',
)
),
);
$bean->save();
}
/**
* Implements hook_uninstall().
*/
function my_module_uninstall() {
bean_load_delta('my-delta')->delete();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment