Programmatically adding registration type (Entity Registration module) I am trying to programmatically add a registration type using the Entity Registration module and Drupal 7.

Currently I am using the following code: 

$bundle = array(
    'type' =&gt; 'flake',
    'label' =&gt; $t('Flake'),
    'base' =&gt; 'registration',
    'custom' =&gt; TRUE,
);

$registration_type = registration_entity_set_default_settings($bundle);

registration_type_save($registration_type);


Among other thing, I have tried 'name' instead of 'label' and 'entity_registration' instead of 'registration'.

As you can probably gather, I am new to creating types of any sort. I started by working off a tutorial for creating a regular content type and did not run into any problems. Figuring out how exactly that differs from the entity registration type has been a little challenging.
Registration _type is just an entity type so is exactly the same as creating any other entity:

$registration_type = entity_create('registration_type', array(
    'name' =&gt; 'flake',
    'label' =&gt; 'Flake',
));
entity_save('registration_type', $registration_type);


Sometimes it helps to create an entity via the UI provided with a module and then load and inspect it to help understand what values can be provided.

For example after creating a registration type visit /devel/php (make sure devel module is enabled) and run this code:

dpm(entity_load_single('registration_type', 1));


You should see an output similar to this: