maybe my title is not correct but I have written a module that creates a new entity. Now I would like to create a few of these entities on hook_install. I can create a new entity, that's not the problem, but I cannot create the entity types.
This is my code I use to create a new entity:
/**
* Implements hook_install()
*/
function skilt_badge_install(){
$entity = entity_create('skilt_badge', array('type' =>'test'));
$entity->title = "Testtitle";
$entity->description = "Testdescription";
$entity->save();
}
Now, when I create a new Skilt badge type with the machine name "test" in the drupal interface it works. But first I would like to know how I create the Skilt badge type programmatically.
I've tried something like this first, thinking the type is also an entity:
/**
* Implements hook_install()
*/
function skilt_badge_install(){
$entity = entity_create('skilt_badge_type');
$entity->title = "Testtitle";
$entity->description = "Testdescription";
$entity->save();
}
But that didn't really work because entity create requires a type...
Could you guys help me?