You are here

function registration_register_page in Entity Registration 8

Same name and namespace in other branches
  1. 8.2 registration.module \registration_register_page()
  2. 7.2 registration.module \registration_register_page()
  3. 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.

Return value

array A render array

See also

registration_register_access()

registration_menu()

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 545

Code

function registration_register_page($entity_type, $entity) {
  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,
    ));
    return \Drupal::formBuilder()
      ->getForm('registration_form', $registration);
  }
  else {
    return t('Sorry, registrations are no longer available for %name', array(
      '%name' => $entity
        ->label(),
    ));
  }
}