public static function EntityformSubmission::baseFieldDefinitions in Entityform 8.2
Same name and namespace in other branches
- 8.3 src/Entity/EntityformSubmission.php \Drupal\entityform\Entity\EntityformSubmission::baseFieldDefinitions()
Provides base field definitions for an entity type.
Implementations typically use the class \Drupal\Core\Field\BaseFieldDefinition for creating the field definitions; for example a 'name' field could be defined as the following:
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'));
By definition, base fields are fields that exist for every bundle. To provide definitions for fields that should only exist on some bundles, use \Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions().
The definitions returned by this function can be overridden for all bundles by hook_entity_base_field_info_alter() or overridden on a per-bundle basis via 'base_field_override' configuration entities.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition. Useful when a single class is used for multiple, possibly dynamic entity types.
Return value
\Drupal\Core\Field\FieldDefinitionInterface[] An array of base field definitions for the entity type, keyed by field name.
Overrides ContentEntityBase::baseFieldDefinitions
See also
\Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
\Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions()
File
- lib/
Drupal/ entityform/ Entity/ EntityformSubmission.php, line 176 - Definition of Drupal\entityform\Entity\EntityformSubmission.
Class
- EntityformSubmission
- Defines the entityform entity class.
Namespace
Drupal\entityform\EntityCode
public static function baseFieldDefinitions($entity_type) {
$properties['eid'] = array(
'label' => t('Entityform Submission ID'),
'description' => t('The entityform submission ID.'),
'type' => 'integer_field',
'read-only' => TRUE,
);
$properties['uuid'] = array(
'label' => t('UUID'),
'description' => t('The Entityform Submission UUID.'),
'type' => 'uuid_field',
'read-only' => TRUE,
);
$properties['vid'] = array(
'label' => t('Revision ID'),
'description' => t('The Entityform Submission revision ID.'),
'type' => 'integer_field',
'read-only' => TRUE,
);
$properties['type'] = array(
'label' => t('Type'),
'description' => t('The Entityform Submission type.'),
'type' => 'string_field',
'read-only' => TRUE,
);
$properties['langcode'] = array(
'label' => t('Language code'),
'description' => t('The Entityform Submission language code.'),
'type' => 'language_field',
);
$properties['uid'] = array(
'label' => t('User ID'),
'description' => t('The user ID of the Entityform Submission author.'),
'type' => 'entity_reference_field',
'settings' => array(
'target_type' => 'user',
'default_value' => 0,
),
);
$properties['created'] = array(
'label' => t('Created'),
'description' => t('The time that the Entityform Submission was created.'),
'type' => 'integer_field',
);
$properties['changed'] = array(
'label' => t('Changed'),
'description' => t('The time that the Entityform Submission was last edited.'),
'type' => 'integer_field',
'property_constraints' => array(
'value' => array(
'EntityChanged' => array(),
),
),
);
$properties['revision_timestamp'] = array(
'label' => t('Revision timestamp'),
'description' => t('The time that the current revision was created.'),
'type' => 'integer_field',
'queryable' => FALSE,
);
$properties['revision_uid'] = array(
'label' => t('Revision user ID'),
'description' => t('The user ID of the author of the current revision.'),
'type' => 'entity_reference_field',
'settings' => array(
'target_type' => 'user',
),
'queryable' => FALSE,
);
$properties['log'] = array(
'label' => t('Log'),
'description' => t('The log entry explaining the changes in this version.'),
'type' => 'string_field',
);
return $properties;
}