comparison core/modules/user/src/Entity/User.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
7 use Drupal\Core\Entity\EntityStorageInterface; 7 use Drupal\Core\Entity\EntityStorageInterface;
8 use Drupal\Core\Entity\EntityTypeInterface; 8 use Drupal\Core\Entity\EntityTypeInterface;
9 use Drupal\Core\Field\BaseFieldDefinition; 9 use Drupal\Core\Field\BaseFieldDefinition;
10 use Drupal\Core\Language\LanguageInterface; 10 use Drupal\Core\Language\LanguageInterface;
11 use Drupal\user\RoleInterface; 11 use Drupal\user\RoleInterface;
12 use Drupal\user\StatusItem;
13 use Drupal\user\TimeZoneItem;
12 use Drupal\user\UserInterface; 14 use Drupal\user\UserInterface;
13 15
14 /** 16 /**
15 * Defines the user entity class. 17 * Defines the user entity class.
16 * 18 *
496 // @todo: Define this via an options provider once 498 // @todo: Define this via an options provider once
497 // https://www.drupal.org/node/2329937 is completed. 499 // https://www.drupal.org/node/2329937 is completed.
498 ->addPropertyConstraints('value', [ 500 ->addPropertyConstraints('value', [
499 'AllowedValues' => ['callback' => __CLASS__ . '::getAllowedTimezones'], 501 'AllowedValues' => ['callback' => __CLASS__ . '::getAllowedTimezones'],
500 ]); 502 ]);
503 $fields['timezone']->getItemDefinition()->setClass(TimeZoneItem::class);
501 504
502 $fields['status'] = BaseFieldDefinition::create('boolean') 505 $fields['status'] = BaseFieldDefinition::create('boolean')
503 ->setLabel(t('User status')) 506 ->setLabel(t('User status'))
504 ->setDescription(t('Whether the user is active or blocked.')) 507 ->setDescription(t('Whether the user is active or blocked.'))
505 ->setDefaultValue(FALSE); 508 ->setDefaultValue(FALSE);
509 $fields['status']->getItemDefinition()->setClass(StatusItem::class);
506 510
507 $fields['created'] = BaseFieldDefinition::create('created') 511 $fields['created'] = BaseFieldDefinition::create('created')
508 ->setLabel(t('Created')) 512 ->setLabel(t('Created'))
509 ->setDescription(t('The time that the user was created.')); 513 ->setDescription(t('The time that the user was created.'));
510 514