class NodeRegistrationEntityClass in Node registration 7
Entity class for Node Registrations
Hierarchy
- class \Entity implements EntityInterface
- class \NodeRegistrationEntityClass
Expanded class hierarchy of NodeRegistrationEntityClass
2 string references to 'NodeRegistrationEntityClass'
- node_registration_entity_info in includes/
node_registration.entity.inc - Implements hook_entity_info().
- _nr_webform_fields_event_node in submodules/
nr_webform_fields/ nr_webform_fields.module - Callback for webform_fields to find the event node from a NodeRegistrationEntityClass entity.
File
- includes/
node_registration.entity.inc, line 222 - Entity hooks and callbacks for registrations.
View source
class NodeRegistrationEntityClass extends Entity {
public $nid;
public $node;
public $is_new = 0;
public $registration_id = 0;
public $language = LANGUAGE_NONE;
public $slots = 1;
public $attended = 0;
public $verified = 0;
public $cancelled = 0;
public $waitinglist = 0;
/**
* Override buildContent() to add registration properties.
*/
public function buildContent($view_mode = 'full', $langcode = NULL) {
$node = $this->node ?: node_load($this->nid);
// Extra fields need this... @see _field_extra_fields_pre_render().
$content = array(
'#view_mode' => $view_mode,
);
// Cancel link.
$uri = node_registration_uri($this);
_node_registration_fake_field($content, 'cancel_link', t('Cancel'), array(
'#type' => 'link',
'#title' => t('Cancel registration'),
'#href' => $uri['path'] . '/cancel',
'#access' => node_registration_access($this, 'cancel'),
), FALSE);
// Event node.
$uri = node_uri($node);
_node_registration_fake_field($content, 'event_node', t('Event node'), array(
'#type' => 'link',
'#title' => $node->title,
'#href' => $uri['path'],
'#access' => node_access('view', $node),
));
// Rendered event node.
$node_build = node_view($node, 'teaser');
_node_registration_fake_field($content, 'event_node_content', t('Event node'), $node_build, FALSE);
// Author.
$author = user_load($this->author_uid ?: 0);
_node_registration_fake_field($content, 'author', t('Author'), array(
'#theme' => 'username',
'#account' => $author,
));
// Account.
$account = user_load($this->uid ?: 0);
_node_registration_fake_field($content, 'account', t('Registree'), array(
'#theme' => 'username',
'#account' => $account,
));
// E-mail address.
_node_registration_fake_field($content, 'email', t('E-mail address'), array(
'#markup' => $this->email,
));
// Slots.
_node_registration_fake_field($content, 'slots', t('Slots'), array(
'#markup' => $this->slots,
));
// Attended.
_node_registration_fake_field($content, 'attended', t('Attended'), array(
'#markup' => $this->attended ? t('Yes') : t('No'),
));
$content = entity_get_controller('node_registration')
->buildContent($this, $view_mode, $langcode, $content);
return array(
'#theme' => 'node_registration',
'#registration' => $this,
'#content' => $content,
'#node' => $node,
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Entity:: |
protected | property | 1 | |
Entity:: |
protected | property | ||
Entity:: |
protected | property | ||
Entity:: |
protected | property | ||
Entity:: |
protected | property | ||
Entity:: |
public | function |
Returns the bundle of the entity. Overrides EntityInterface:: |
|
Entity:: |
protected | function | Defines the entity label if the 'entity_class_label' callback is used. | 1 |
Entity:: |
protected | function | Override this in order to implement a custom default URI and specify 'entity_class_uri' as 'uri callback' hook_entity_info(). | |
Entity:: |
public | function |
Permanently deletes the entity. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Returns the info of the type of the entity. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Returns the type of the entity. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Exports the entity. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Gets the raw, translated value of a property or field. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Checks if the entity has a certain exportable status. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Returns the entity identifier, i.e. the entities name or numeric id. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Returns the internal, numeric identifier. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Checks whether the entity is the default revision. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Returns the label of the entity. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Permanently saves the entity. Overrides EntityInterface:: |
|
Entity:: |
protected | function | Set up the object instance on construction or unserializiation. | |
Entity:: |
public | function |
Returns the uri of the entity just as entity_uri(). Overrides EntityInterface:: |
|
Entity:: |
public | function |
Generate an array for rendering the entity. Overrides EntityInterface:: |
|
Entity:: |
public | function |
Returns the EntityMetadataWrapper of the entity. Overrides EntityInterface:: |
|
Entity:: |
public | function | 1 | |
Entity:: |
public | function | Magic method to only serialize what's necessary. | |
Entity:: |
public | function | Magic method to invoke setUp() on unserialization. | |
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | property | ||
NodeRegistrationEntityClass:: |
public | function |
Override buildContent() to add registration properties. Overrides Entity:: |