function registration_install in Entity Registration 8
Same name and namespace in other branches
- 8.2 registration.install \registration_install()
- 7.2 registration.install \registration_install()
- 7 registration.install \registration_install()
Implements hook_install().
File
- ./
registration.install, line 365 - Schema and installation hooks for registration module.
Code
function registration_install() {
// Create default states.
$states = array(
'complete' => array(
'label' => 'Complete',
'description' => 'Registration has been completed.',
'default_state' => 1,
'active' => 1,
'held' => 0,
'show_on_form' => 0,
'weight' => 1,
),
'pending' => array(
'label' => 'Pending',
'description' => 'Registration is pending.',
'default_state' => 0,
'active' => 0,
'held' => 0,
'show_on_form' => 0,
'weight' => 1,
),
'held' => array(
'label' => 'Held',
'description' => 'Registration is held.',
'default_state' => 0,
'active' => 0,
'held' => 1,
'show_on_form' => 0,
'weight' => 1,
),
'canceled' => array(
'label' => 'Canceled',
'description' => 'Registration was cancelled',
'default_state' => 0,
'active' => 0,
'held' => 0,
'show_on_form' => 0,
'weight' => 1,
),
);
foreach ($states as $state_name => $state_label) {
$registration_state = \Drupal::entityManager()
->getStorage('registration_state')
->create(array(
'name' => $state_name,
'label' => $state_label['label'],
'description' => $state_label['description'],
'default_state' => $state_label['default_state'],
'active' => $state_label['active'],
'held' => $state_label['held'],
'show_on_form' => $state_label['show_on_form'],
'weight' => $state_label['weight'],
));
$registration_state
->save();
}
}