comparison core/modules/user/src/Entity/User.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
20 * because "user" is a reserved word in many databases. 20 * because "user" is a reserved word in many databases.
21 * 21 *
22 * @ContentEntityType( 22 * @ContentEntityType(
23 * id = "user", 23 * id = "user",
24 * label = @Translation("User"), 24 * label = @Translation("User"),
25 * label_collection = @Translation("Users"),
26 * label_singular = @Translation("user"),
27 * label_plural = @Translation("users"),
28 * label_count = @PluralTranslation(
29 * singular = "@count user",
30 * plural = "@count users",
31 * ),
25 * handlers = { 32 * handlers = {
26 * "storage" = "Drupal\user\UserStorage", 33 * "storage" = "Drupal\user\UserStorage",
27 * "storage_schema" = "Drupal\user\UserStorageSchema", 34 * "storage_schema" = "Drupal\user\UserStorageSchema",
28 * "access" = "Drupal\user\UserAccessControlHandler", 35 * "access" = "Drupal\user\UserAccessControlHandler",
29 * "list_builder" = "Drupal\user\UserListBuilder", 36 * "list_builder" = "Drupal\user\UserListBuilder",
346 * {@inheritdoc} 353 * {@inheritdoc}
347 */ 354 */
348 public function isAuthenticated() { 355 public function isAuthenticated() {
349 return $this->id() > 0; 356 return $this->id() > 0;
350 } 357 }
358
351 /** 359 /**
352 * {@inheritdoc} 360 * {@inheritdoc}
353 */ 361 */
354 public function isAnonymous() { 362 public function isAnonymous() {
355 return $this->id() == 0; 363 return $this->id() == 0;
418 static::$anonymousUser = new $class([ 426 static::$anonymousUser = new $class([
419 'uid' => [LanguageInterface::LANGCODE_DEFAULT => 0], 427 'uid' => [LanguageInterface::LANGCODE_DEFAULT => 0],
420 'name' => [LanguageInterface::LANGCODE_DEFAULT => ''], 428 'name' => [LanguageInterface::LANGCODE_DEFAULT => ''],
421 // Explicitly set the langcode to ensure that field definitions do not 429 // Explicitly set the langcode to ensure that field definitions do not
422 // need to be fetched to figure out a default. 430 // need to be fetched to figure out a default.
423 'langcode' => [LanguageInterface::LANGCODE_DEFAULT => LanguageInterface::LANGCODE_NOT_SPECIFIED] 431 'langcode' => [LanguageInterface::LANGCODE_DEFAULT => LanguageInterface::LANGCODE_NOT_SPECIFIED],
424 ], $entity_type->id()); 432 ], $entity_type->id());
425 } 433 }
426 return clone static::$anonymousUser; 434 return clone static::$anonymousUser;
427 } 435 }
428 436