function registration_register_page in Entity Registration 8.2
Same name and namespace in other branches
- 8 registration.module \registration_register_page()
- 7.2 registration.module \registration_register_page()
- 7 registration.module \registration_register_page()
Page callback: Add a new registration to a host entity.
Parameters
string $entity_type: The host entity type.
object $entity: The host entity.
string $default_state: The default state to display in the state dropdown in the form.
Return value
array A render array
See also
registration_register_access()
1 string reference to 'registration_register_page'
- registration_menu in ./
registration.module - @FIXME This implementation of hook_menu() cannot be automatically converted because it contains logic (i.e., branching statements, function calls, object instantiation, etc.) You will need to convert it manually. Sorry!
File
- ./
registration.module, line 565
Code
function registration_register_page($entity_type, $entity, $default_state = NULL) {
list($entity_id) = entity_extract_ids($entity_type, $entity);
if (registration_status($entity_type, $entity_id)) {
$registration_type = registration_get_entity_registration_type($entity_type, $entity);
$registration = entity_get_controller('registration')
->create(array(
'entity_type' => $entity_type,
'entity_id' => $entity_id,
'type' => $registration_type,
));
if (\Drupal::currentUser()
->hasPermission("edit {$registration_type} registration state")) {
$registration->state = $default_state;
}
return \Drupal::formBuilder()
->getForm('registration_form', $registration);
}
else {
return t('Sorry, registrations are no longer available for %name', array(
'%name' => $entity
->label(),
));
}
}