class Registration in Entity Registration 8
Same name and namespace in other branches
- 8.2 src/Registration.php \Drupal\registration\Registration
Defines the Registration entity.
Plugin annotation
@ContentEntityType(
id = "registration",
label = @Translation("Registration"),
fieldable = TRUE,
handlers = {
"list_builder" = "Drupal\registration\Controller\MailchimpSignupListBuilder",
"form" = {
"add" = "Drupal\registration\Form\RegistrationForm",
"edit" = "Drupal\registration\Form\RegistrationForm",
"delete" = "Drupal\registration\Form\RegistrationDeleteForm"
}
},
config_prefix = "registration",
admin_permission = "administer registrations",
entity_keys = {
"id" = "registration_id",
"bundle" = "type",
},
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\migrate\Plugin\migrate\destination\DestinationBase implements MigrateDestinationInterface, RequirementsInterface
- class \Drupal\migrate\Plugin\migrate\destination\Entity implements DependentPluginInterface, ContainerFactoryPluginInterface uses DependencyTrait, EntityFieldDefinitionTrait
- class \Drupal\migrate\Plugin\migrate\destination\EntityContentBase implements HighestIdInterface, MigrateValidatableEntityInterface uses DeprecatedServicePropertyTrait
- class \Drupal\registration\Registration implements RegistrationInterface
- class \Drupal\migrate\Plugin\migrate\destination\EntityContentBase implements HighestIdInterface, MigrateValidatableEntityInterface uses DeprecatedServicePropertyTrait
- class \Drupal\migrate\Plugin\migrate\destination\Entity implements DependentPluginInterface, ContainerFactoryPluginInterface uses DependencyTrait, EntityFieldDefinitionTrait
- class \Drupal\migrate\Plugin\migrate\destination\DestinationBase implements MigrateDestinationInterface, RequirementsInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of Registration
7 string references to 'Registration'
- registration.info.yml in ./
registration.info.yml - registration.info.yml
- RegistrationWaitlistTestCase::getInfo in modules/
registration_waitlist/ registration_waitlist.test - RegistrationWaitlistTestCase::testHostRegistrationWaitlistStatus in modules/
registration_waitlist/ registration_waitlist.test - Check internal status modifiers for the wait list.
- registration_entity_info in ./
registration.module - Implements hook_entity_info().
- 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
- src/
Registration.php, line 34
Namespace
Drupal\registrationView source
class Registration extends EntityContentBase implements RegistrationInterface {
public $registration_id, $type, $entity_id, $entity_type, $anon_mail = NULL, $user_uid = NULL, $count, $author_uid, $state, $created, $updated;
/**
* Specifies the default label, which is picked up by label() by default.
*/
protected function label() {
$wrapper = entity_metadata_wrapper('registration', $this);
$host = $wrapper->entity
->value();
if ($host) {
return t('Registration for !title', array(
'!title' => $host
->label(),
));
}
return '';
}
/**
* Build content for Registration.
*
* @return array
* Render array for a registration entity.
*/
public function buildContent($view_mode = 'full', $langcode = NULL) {
$build = parent::buildContent($view_mode, $langcode);
$wrapper = entity_metadata_wrapper('registration', $this);
$host_entity_type_info = \Drupal::entityManager()
->getDefinition($this->entity_type);
$host_entity = $wrapper->entity
->value();
$state = $wrapper->state
->value();
$author = $wrapper->author
->value();
$user = $wrapper->user
->value();
list(, , $host_entity_bundle) = entity_extract_ids($this->entity_type, $host_entity);
$host_label = $host_entity
->label();
$host_uri = $host_entity ? entity_uri($this->entity_type, $host_entity) : NULL;
$build['mail'] = array(
'#theme' => 'registration_property_field',
'#label' => t('Email Address'),
'#items' => array(
array(
'#markup' => $wrapper->mail
->value(),
),
),
'#classes' => 'field field-label-inline clearfix',
);
// Link to host entity.
$host_entity_link_label = isset($host_entity_type_info['bundles'][$host_entity_bundle]['label']) ? '<div class="field-label">' . $host_entity_type_info['bundles'][$host_entity_bundle]['label'] . '</div>' : '';
// @FIXME
// l() expects a Url object, created from a route name or external URI.
// $build['host_entity_link'] = array(
// '#theme' => 'registration_property_field',
// '#label' => $host_entity_link_label,
// '#items' => array(
// array(
// '#markup' => l($host_label, $host_uri['path']),
// ),
// ),
// '#classes' => 'field field-label-inline clearfix',
// );
$build['created'] = array(
'#theme' => 'registration_property_field',
'#label' => t('Created'),
'#items' => array(
array(
'#markup' => format_date($this->created),
),
),
'#classes' => 'field field-label-inline clearfix',
);
$build['updated'] = array(
'#theme' => 'registration_property_field',
'#label' => t('Updated'),
'#items' => array(
array(
'#markup' => format_date($this->updated),
),
),
'#classes' => 'field field-label-inline clearfix',
);
$build['slots'] = array(
'#theme' => 'registration_property_field',
'#label' => t('Slots Used'),
'#items' => array(
array(
'#markup' => $this->count,
),
),
'#classes' => 'field field-label-inline clearfix',
);
if ($author) {
$build['author'] = array(
'#theme' => 'registration_property_field',
'#label' => t('Author'),
'#items' => array(
array(
'#markup' => _theme('username', array(
'account' => $author,
)),
),
),
'#classes' => 'field field-label-inline clearfix',
'#attributes' => '',
);
}
if ($user) {
$build['user'] = array(
'#theme' => 'registration_property_field',
'#label' => t('User'),
'#items' => array(
array(
'#markup' => _theme('username', array(
'account' => $user,
)),
),
),
'#classes' => 'field field-label-inline clearfix',
'#attributes' => '',
);
}
$build['state'] = array(
'#theme' => 'registration_property_field',
'#label' => t('State'),
'#items' => array(
array(
'#markup' => $state ? filter_xss_admin($state
->label()) : '',
),
),
'#classes' => 'field field-label-inline clearfix',
);
return $build;
}
/**
* Save registration.
*
* @see entity_save()
*/
public function save() {
// Set a default state if not provided.
$wrapper = entity_metadata_wrapper('registration', $this);
$state = $wrapper->state
->value();
if (!$state) {
$default_state = registration_get_default_state($wrapper->type
->value());
if ($default_state) {
$this->state = $default_state
->identifier();
}
}
$this->updated = REQUEST_TIME;
if (!$this->registration_id && empty($this->created)) {
$this->created = REQUEST_TIME;
}
return parent::save();
}
/**
* Specify URI.
*/
protected function defaultUri() {
return array(
'path' => 'registration/' . $this
->internalIdentifier(),
);
}
/**
* Determine registrant type relative to a given account.
*
* @object $account
* A Drupal user
*
* @return string|NULL
* Can be me, user, anon or NULL if account is empty and no anon email set.
*/
public function registrant_type($account) {
$reg_type = NULL;
if (!empty($account)) {
if ($account->uid && $account->uid === $this->user_uid) {
$reg_type = REGISTRATION_REGISTRANT_TYPE_ME;
}
elseif ($this->user_uid) {
$reg_type = REGISTRATION_REGISTRANT_TYPE_USER;
}
}
if (!empty($this->anon_mail)) {
$reg_type = REGISTRATION_REGISTRANT_TYPE_ANON;
}
return $reg_type;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AccessibleInterface:: |
public | function | Checks data value access. | 9 |
CacheableDependencyInterface:: |
public | function | The cache contexts associated with this object. | 34 |
CacheableDependencyInterface:: |
public | function | The maximum age for which this object may be cached. | 34 |
CacheableDependencyInterface:: |
public | function | The cache tags associated with this object. | 27 |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
DependencyTrait:: |
protected | property | The object's dependencies. | |
DependencyTrait:: |
protected | function | Adds multiple dependencies. | |
DependencyTrait:: |
protected | function | Adds a dependency. | |
DeprecatedServicePropertyTrait:: |
public | function | Allows to access deprecated/removed properties. | |
DestinationBase:: |
protected | property | The migration. | |
DestinationBase:: |
protected | property | The rollback action to be saved for the last imported item. | |
DestinationBase:: |
protected | property | Indicates whether the destination can be rolled back. | |
DestinationBase:: |
public | function |
Checks if requirements for this plugin are OK. Overrides RequirementsInterface:: |
|
DestinationBase:: |
public | function |
Gets the destination module handling the destination data. Overrides MigrateDestinationInterface:: |
1 |
DestinationBase:: |
public | function |
The rollback action for the last imported item. Overrides MigrateDestinationInterface:: |
|
DestinationBase:: |
protected | function | For a destination item being updated, set the appropriate rollback action. | |
DestinationBase:: |
public | function |
Whether the destination can be rolled back or not. Overrides MigrateDestinationInterface:: |
|
Entity:: |
protected | property | The list of the bundles of this entity type. | |
Entity:: |
protected | property | The entity storage. | |
Entity:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
|
Entity:: |
public | function |
Returns an array of destination fields. Overrides MigrateDestinationInterface:: |
|
Entity:: |
public | function | Gets the bundle for the row taking into account the default. | |
Entity:: |
protected | function | Creates or loads an entity. | 5 |
Entity:: |
protected | function | Gets the entity ID of the row. | 2 |
Entity:: |
protected | function | Returns a specific entity key. | |
EntityChangedInterface:: |
public | function | Gets the timestamp of the last entity change for the current translation. | |
EntityChangedInterface:: |
public | function | Gets the timestamp of the last entity change across all translations. | |
EntityChangedInterface:: |
public | function | Sets the timestamp of the last entity change for the current translation. | |
EntityContentBase:: |
protected | property | ||
EntityContentBase:: |
protected | property | Entity field manager. | |
EntityContentBase:: |
protected | property | Field type plugin manager. | |
EntityContentBase:: |
public static | function |
Creates an instance of the plugin. Overrides Entity:: |
2 |
EntityContentBase:: |
public | function |
Returns the highest ID tracked by the implementing plugin. Overrides HighestIdInterface:: |
2 |
EntityContentBase:: |
public | function |
Gets the destination IDs. Overrides MigrateDestinationInterface:: |
2 |
EntityContentBase:: |
public | function |
Overrides MigrateDestinationInterface:: |
3 |
EntityContentBase:: |
public | function |
Returns a state of whether an entity needs to be validated before saving. Overrides MigrateValidatableEntityInterface:: |
|
EntityContentBase:: |
public | function | ||
EntityContentBase:: |
protected | function | Populates as much of the stub row as possible. | 3 |
EntityContentBase:: |
public | function |
Delete the specified destination object from the target Drupal. Overrides Entity:: |
1 |
EntityContentBase:: |
protected | function | Updates an entity with the new values from row. | 3 |
EntityContentBase:: |
public | function |
Validates the entity. Overrides MigrateValidatableEntityInterface:: |
|
EntityContentBase:: |
public | function |
Constructs a content entity. Overrides Entity:: |
3 |
EntityFieldDefinitionTrait:: |
protected | function | Gets the field definition from a specific entity base field. | |
EntityFieldDefinitionTrait:: |
protected static | function | Finds the entity type from configuration or plugin ID. | 5 |
EntityInterface:: |
public | function | Gets the bundle of the entity. | 2 |
EntityInterface:: |
public | function | Creates a duplicate of the entity. | 2 |
EntityInterface:: |
public | function | Deletes an entity permanently. | 2 |
EntityInterface:: |
public | function | Enforces an entity to be new. | 2 |
EntityInterface:: |
public | function | Returns the cache tags that should be used to invalidate caches. | 2 |
EntityInterface:: |
public | function | Gets the key that is used to store configuration dependencies. | 2 |
EntityInterface:: |
public | function | Gets the configuration dependency name. | 2 |
EntityInterface:: |
public | function | Gets the configuration target identifier for the entity. | 2 |
EntityInterface:: |
public | function | Gets the entity type definition. | 2 |
EntityInterface:: |
public | function | Gets the original ID. | 2 |
EntityInterface:: |
public | function | Gets a typed data object for this entity object. | 2 |
EntityInterface:: |
public | function | Indicates if a link template exists for a given key. | 2 |
EntityInterface:: |
public | function | Gets the identifier. | 2 |
EntityInterface:: |
public | function | Determines whether the entity is new. | 2 |
EntityInterface:: |
public | function | Gets the language of the entity. | 2 |
EntityInterface:: |
public | function | Deprecated way of generating a link to the entity. See toLink(). | 2 |
EntityInterface:: |
public static | function | Loads an entity. | 2 |
EntityInterface:: |
public static | function | Loads one or more entities. | 2 |
EntityInterface:: |
public | function | Acts on a created entity before hooks are invoked. | 2 |
EntityInterface:: |
public static | function | Acts on deleted entities before the delete hook is invoked. | 2 |
EntityInterface:: |
public static | function | Acts on loaded entities. | 3 |
EntityInterface:: |
public | function | Acts on a saved entity before the insert or update hook is invoked. | 2 |
EntityInterface:: |
public static | function | Changes the values of an entity before it is created. | 2 |
EntityInterface:: |
public static | function | Acts on entities before they are deleted and before hooks are invoked. | 2 |
EntityInterface:: |
public | function | Acts on an entity before the presave hook is invoked. | 2 |
EntityInterface:: |
public | function | Gets a list of entities referenced by this entity. | 2 |
EntityInterface:: |
public | function | Sets the original ID. | 2 |
EntityInterface:: |
public | function | Generates the HTML for a link to this entity. | 2 |
EntityInterface:: |
public | function | Gets the URL object for the entity. | 2 |
EntityInterface:: |
public | function | Gets a list of URI relationships supported by this entity. | 2 |
EntityInterface:: |
public | function | Gets the public URL for this entity. | 2 |
EntityInterface:: |
public | function | Gets the URL object for the entity. | 2 |
EntityInterface:: |
public | function | Gets the entity UUID (Universally Unique Identifier). | 2 |
EntityOwnerInterface:: |
public | function | Returns the entity owner's user entity. | 1 |
EntityOwnerInterface:: |
public | function | Returns the entity owner's user ID. | 1 |
EntityOwnerInterface:: |
public | function | Sets the entity owner's user entity. | 1 |
EntityOwnerInterface:: |
public | function | Sets the entity owner's user ID. | 1 |
FieldableEntityInterface:: |
public static | function | Provides base field definitions for an entity type. | 2 |
FieldableEntityInterface:: |
public static | function | Provides field definitions for a specific bundle. | 2 |
FieldableEntityInterface:: |
public | function | Gets a field item list. | 1 |
FieldableEntityInterface:: |
public | function | Gets the definition of a contained field. | 1 |
FieldableEntityInterface:: |
public | function | Gets an array of field definitions of all contained fields. | 1 |
FieldableEntityInterface:: |
public | function | Gets an array of all field item lists. | 1 |
FieldableEntityInterface:: |
public | function | Gets an array of field item lists for translatable fields. | 1 |
FieldableEntityInterface:: |
public | function | Determines whether the entity has a field with the given name. | 1 |
FieldableEntityInterface:: |
public | function | Checks whether entity validation is required before saving the entity. | 1 |
FieldableEntityInterface:: |
public | function | Reacts to changes to a field. | 1 |
FieldableEntityInterface:: |
public | function | Sets a field value. | 1 |
FieldableEntityInterface:: |
public | function | Sets whether entity validation is required before saving the entity. | 1 |
FieldableEntityInterface:: |
public | function |
Gets an array of all field values. Overrides EntityInterface:: |
|
FieldableEntityInterface:: |
public | function | Validates the currently set values. | 1 |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
RefinableCacheableDependencyInterface:: |
public | function | Adds a dependency on an object: merges its cacheability metadata. | 1 |
RefinableCacheableDependencyInterface:: |
public | function | Adds cache contexts. | 1 |
RefinableCacheableDependencyInterface:: |
public | function | Adds cache tags. | 1 |
RefinableCacheableDependencyInterface:: |
public | function | Merges the maximum age (in seconds) with the existing maximum age. | 1 |
Registration:: |
public | property | ||
Registration:: |
public | function | Build content for Registration. | |
Registration:: |
protected | function | Specify URI. | |
Registration:: |
protected | function |
Specifies the default label, which is picked up by label() by default. Overrides EntityInterface:: |
|
Registration:: |
public | function | Determine registrant type relative to a given account. | |
Registration:: |
public | function |
Save registration. Overrides EntityContentBase:: |
|
RevisionableInterface:: |
public | function | Gets the loaded Revision ID of the entity. | 1 |
RevisionableInterface:: |
public | function | Gets the revision identifier of the entity. | 1 |
RevisionableInterface:: |
public | function | Checks if this entity is the default revision. | 1 |
RevisionableInterface:: |
public | function | Checks if this entity is the latest revision. | 1 |
RevisionableInterface:: |
public | function | Determines whether a new revision should be created on save. | 1 |
RevisionableInterface:: |
public | function | Acts on a revision before it gets saved. | 1 |
RevisionableInterface:: |
public | function | Enforces an entity to be saved as a new revision. | 1 |
RevisionableInterface:: |
public | function | Updates the loaded Revision ID with the revision ID. | 1 |
RevisionableInterface:: |
public | function | Checks whether the entity object was a default revision when it was saved. | 1 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
SynchronizableInterface:: |
public | function | Returns whether this entity is being changed as part of a synchronization. | 1 |
SynchronizableInterface:: |
public | function | Sets the status of the synchronization flag. | 1 |
TranslatableInterface:: |
public | function | Adds a new translation to the translatable object. | 1 |
TranslatableInterface:: |
public | function | Gets a translation of the data. | 1 |
TranslatableInterface:: |
public | function | Returns the languages the data is translated to. | 1 |
TranslatableInterface:: |
public | function | Returns the translatable object referring to the original language. | 1 |
TranslatableInterface:: |
public | function | Checks there is a translation for the given language code. | 1 |
TranslatableInterface:: |
public | function | Determines if the current translation of the entity has unsaved changes. | 1 |
TranslatableInterface:: |
public | function | Checks whether the translation is the default one. | 1 |
TranslatableInterface:: |
public | function | Checks whether the translation is new. | 1 |
TranslatableInterface:: |
public | function | Returns the translation support status. | 1 |
TranslatableInterface:: |
public | function | Removes the translation identified by the given language code. | 1 |
TranslatableRevisionableInterface:: |
public | function | Checks if untranslatable fields should affect only the default translation. | 1 |
TranslatableRevisionableInterface:: |
public | function | Checks whether this is the latest revision affecting this translation. | 1 |
TranslatableRevisionableInterface:: |
public | function | Checks whether the current translation is affected by the current revision. | 1 |
TranslatableRevisionableInterface:: |
public | function | Checks if the revision translation affected flag value has been enforced. | 1 |
TranslatableRevisionableInterface:: |
public | function | Marks the current revision translation as affected. | 1 |
TranslatableRevisionableInterface:: |
public | function | Enforces the revision translation affected flag value. | 1 |