You are here

function node_registration_entity_property_info_alter in Node registration 7

Implements hook_entity_property_info_alter().

File

includes/node_registration.entity.inc, line 334
Entity hooks and callbacks for registrations.

Code

function node_registration_entity_property_info_alter(&$info) {

  // NODE properties.
  $properties =& $info['node']['properties'];

  // Event start.
  $properties['event_start'] = array(
    'label' => t("Event start"),
    'description' => t("Event start according to node type setup."),
    'type' => 'date',
    'getter callback' => 'node_registration_metadata_entity_get_properties',
  );

  // Time left.
  $properties['time_left'] = array(
    'label' => t("Time left"),
    'description' => t("Time left according to node type setup."),
    'type' => 'text',
    'getter callback' => 'node_registration_metadata_entity_get_properties',
  );

  // Capacity.
  $properties['capacity'] = array(
    'label' => t("Capacity"),
    'description' => t("Number of slots available."),
    'type' => 'integer',
    'getter callback' => 'node_registration_metadata_entity_get_properties',
  );

  // Slots taken.
  $properties['slots_taken'] = array(
    'label' => t("Slots taken"),
    'description' => t("Number of slots taken."),
    'type' => 'integer',
    'getter callback' => 'node_registration_metadata_entity_get_properties',
  );

  // Slots left.
  $properties['slots_left'] = array(
    'label' => t("Slots left"),
    'description' => t("Number of open slots left."),
    'type' => 'integer',
    'getter callback' => 'node_registration_metadata_entity_get_properties',
  );

  // Unset pointer. I'm paranoid about PHP references.
  unset($properties);

  // REGISTRATION properties.
  $properties =& $info['node_registration']['properties'];

  // E-mail.
  $properties['email'] = array(
    'label' => t("E-mail address"),
    'description' => t("The registree's e-mail address."),
    'type' => 'text',
    'schema field' => 'email',
    'setter callback' => 'entity_property_verbatim_set',
  );
  $properties['mail'] = array(
    'label' => t("E-mail address"),
    'description' => t("Alias for [node-registration:email] because Drupal likes [x:mail] tokens better."),
    'type' => 'text',
    'schema field' => 'email',
    'setter callback' => 'entity_property_verbatim_set',
  );

  // Type / bundle.
  $properties['type'] = array(
    'label' => t("Type"),
    'description' => t("The registration's entity bundle."),
    'type' => 'text',
    'schema field' => 'type',
  );

  // Node type.
  $properties['node_type'] = array(
    'label' => t("Node type"),
    'description' => t("The node type's machine name."),
    'type' => 'text',
    'schema field' => 'node_type',
  );

  // Slots.
  $properties['slots'] = array(
    'label' => t("Slots"),
    'description' => t("The number of slots consumed by this user."),
    'type' => 'integer',
    'schema field' => 'slots',
    'setter callback' => 'entity_property_verbatim_set',
  );

  // Created.
  $properties['created'] = array(
    'label' => t("Created"),
    'description' => t("The date the registration was created."),
    'type' => 'date',
    'schema field' => 'created',
    'setter callback' => 'entity_property_verbatim_set',
  );

  // Updated.
  $properties['updated'] = array(
    'label' => t("Updated"),
    'description' => t("The date the registration was updated."),
    'type' => 'date',
    'schema field' => 'updated',
    'setter callback' => 'entity_property_verbatim_set',
  );

  // Weight.
  $properties['weight'] = array(
    'label' => t("Weight"),
    'description' => t("The weight of this registration in this event. Used for waitinglist execution order and display."),
    'type' => 'integer',
    'schema field' => 'weight',
    'setter callback' => 'entity_property_verbatim_set',
  );

  // Node entity.
  $properties['nid'] = array(
    'label' => t('Node nid'),
    'type' => 'integer',
  );
  $properties['node'] = array(
    'label' => t("Node"),
    'description' => t("The node this registration is associated with."),
    'type' => 'node',
    'schema field' => 'nid',
  );

  // Author user entity.
  $properties['author_uid'] = array(
    'label' => t('Author uid'),
    'type' => 'integer',
  );
  $properties['author'] = array(
    'label' => t("Author"),
    'description' => t("The user that <strong>made</strong> this registration."),
    'type' => 'user',
    'schema field' => 'author_uid',
  );

  // Registree user entity.
  $properties['uid'] = array(
    'label' => t('User uid'),
    'type' => 'integer',
  );
  $properties['user'] = array(
    'label' => t("User"),
    'description' => t("The user that's registered."),
    'type' => 'user',
    'schema field' => 'uid',
  );

  // Registree user name. Can be used to set `uid` indirectly (magic in ctrlr->save()).
  $properties['user_name'] = array(
    'label' => t("User name"),
    'description' => t("The user's username."),
    'type' => 'text',
    'schema field' => 'uid',
  );

  // Registree user mail. Can be used to set `uid` indirectly (magic in ctrlr->save()).
  $properties['user_mail'] = array(
    'label' => t("User mail"),
    'description' => t("The user's e-mail address."),
    'type' => 'text',
    'schema field' => 'uid',
  );

  // View URL.
  $properties['url'] = array(
    'label' => t("View URL"),
    'description' => t("The URL to view the registration."),
    'type' => 'uri',
    'getter callback' => 'node_registration_metadata_entity_get_properties',
  );

  // Edit URL.
  $properties['edit_url'] = array(
    'label' => t("Edit URL"),
    'description' => t("The URL to edit the registration."),
    'type' => 'uri',
    'getter callback' => 'node_registration_metadata_entity_get_properties',
  );

  // Cancel URL.
  $properties['cancel_url'] = array(
    'label' => t("Cancel URL"),
    'description' => t("The URL to cancel the registration."),
    'type' => 'uri',
    'getter callback' => 'node_registration_metadata_entity_get_properties',
  );

  // Booleans.
  $properties['attended'] = array(
    'label' => t("Attended"),
    'description' => t("Whether the registree attended the event."),
    'type' => 'boolean',
    'schema field' => 'attended',
    'setter callback' => 'entity_property_verbatim_set',
  );
  $properties['verified'] = array(
    'label' => t("Verified"),
    'description' => t("Whether the registration was verified."),
    'type' => 'boolean',
    'schema field' => 'verified',
    'setter callback' => 'entity_property_verbatim_set',
  );
  $properties['cancelled'] = array(
    'label' => t("Cancelled"),
    'description' => t("Whether the registration was cancelled."),
    'type' => 'boolean',
    'schema field' => 'cancelled',
    'setter callback' => 'entity_property_verbatim_set',
  );
  $properties['reminder_sent'] = array(
    'label' => t("Reminder sent"),
    'description' => t("Whether the registree was sent a reminder."),
    'type' => 'boolean',
    'schema field' => 'reminder_sent',
    'setter callback' => 'entity_property_verbatim_set',
  );
  $properties['waitinglist'] = array(
    'label' => t("Waiting list"),
    'description' => t("Whether the registration is on the waiting list."),
    'type' => 'boolean',
    'schema field' => 'waitinglist',
  );
}