diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index ee39777..3e12f7e 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -548,51 +548,6 @@ public function getFieldValue($field_name, $property) { } /** - * Gets the value of a specific property of a field. - * - * Only the first delta can be accessed with this method. - * - * @param string $field_name - * The name of the field. - * @param string $property - * The field property, "value" for many field types. - * - * @return mixed - */ - public function getFieldValue($field_name, $property) { - // Attempt to get the value from the values directly if the field is not - // initialized yet. - if (!isset($this->fields[$field_name])) { - $field_values = NULL; - if (isset($this->values[$field_name][$this->activeLangcode])) { - $field_values = $this->values[$field_name][$this->activeLangcode]; - } - elseif ($this->values[$field_name][LanguageInterface::LANGCODE_DEFAULT]) { - $field_values = $this->values[$field_name][LanguageInterface::LANGCODE_DEFAULT]; - } - - if ($field_values !== NULL) { - // If there are field values, try to get the property value. - // Configurable/Multi-value fields are stored differently, try accessing - // with delta and property first, then without delta and last, if the - // value are a scalar, just return that. - if (isset($field_values[0][$property]) && is_array($field_values[0])) { - return $field_values[0][$property]; - } - elseif (isset($field_values[$property]) && is_array($field_values)) { - return $field_values[$property]; - } - elseif (!is_array($field_values)) { - return $field_values; - } - } - } - - // Fall back to access the property through the field object. - return $this->get($field_name)->$property; - } - - /** * {@inheritdoc} */ public function set($name, $value, $notify = TRUE) { diff --git a/core/modules/user/src/Authentication/Provider/Cookie.php b/core/modules/user/src/Authentication/Provider/Cookie.php index dd2b319..37051b8 100644 --- a/core/modules/user/src/Authentication/Provider/Cookie.php +++ b/core/modules/user/src/Authentication/Provider/Cookie.php @@ -3,12 +3,9 @@ namespace Drupal\user\Authentication\Provider; use Drupal\Core\Authentication\AuthenticationProviderInterface; -use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Session\UserSession; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Session\SessionConfigurationInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Session\SessionInterface; /** * Cookie based authentication provider. @@ -23,23 +20,23 @@ class Cookie implements AuthenticationProviderInterface { protected $sessionConfiguration; /** - * The entity manager. + * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityManager; + protected $entityTypeManager; /** * Constructs a new cookie authentication provider. * * @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration * The session configuration. - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * The entity type manager. */ - public function __construct(SessionConfigurationInterface $session_configuration, EntityManagerInterface $entity_manager) { + public function __construct(SessionConfigurationInterface $session_configuration, EntityTypeManagerInterface $entity_type_manager) { $this->sessionConfiguration = $session_configuration; - $this->entityManager = $entity_manager; + $this->entityTypeManager = $entity_type_manager; } /** @@ -55,7 +52,7 @@ public function applies(Request $request) { public function authenticate(Request $request) { if ($uid = $request->getSession()->get('uid')) { /** @var \Drupal\user\UserInterface $user */ - if ($user = $this->entityManager->getStorage('user')->load($uid)) { + if ($user = $this->entityTypeManager->getStorage('user')->load($uid)) { if ($user->isActive()) { return $user; } diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index f2b2910..5dd31be 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -315,7 +315,7 @@ public function block() { * {@inheritdoc} */ public function getTimeZone() { - return $this->getFieldValue('timezone', 'value') ?: ''; + return $this->getFieldValue('timezone', 'value'); } /** diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml index a2c373b..315cb6e 100644 --- a/core/modules/user/user.services.yml +++ b/core/modules/user/user.services.yml @@ -17,7 +17,7 @@ services: - { name: access_check, applies_to: _user_is_logged_in } user.authentication.cookie: class: Drupal\user\Authentication\Provider\Cookie - arguments: ['@session_configuration', '@entity.manager'] + arguments: ['@session_configuration', '@entity_type.manager'] tags: - { name: authentication_provider, provider_id: 'cookie', priority: 0, global: TRUE } user.data: