X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fuser%2Fsrc%2FAccountForm.php;fp=web%2Fcore%2Fmodules%2Fuser%2Fsrc%2FAccountForm.php;h=080f0bf3f9c1992af2df2a7c2b501a0fc30b725d;hp=d6959681f48ac46672b404d0a201f44067d91d07;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/user/src/AccountForm.php b/web/core/modules/user/src/AccountForm.php index d6959681f..080f0bf3f 100644 --- a/web/core/modules/user/src/AccountForm.php +++ b/web/core/modules/user/src/AccountForm.php @@ -6,7 +6,7 @@ use Drupal\Component\Datetime\TimeInterface; use Drupal\Component\Utility\Crypt; use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityConstraintViolationListInterface; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageInterface; @@ -31,8 +31,8 @@ abstract class AccountForm extends ContentEntityForm { /** * Constructs a new EntityForm object. * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. + * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository + * The entity repository. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info @@ -40,8 +40,8 @@ abstract class AccountForm extends ContentEntityForm { * @param \Drupal\Component\Datetime\TimeInterface $time * The time service. */ - public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) { - parent::__construct($entity_manager, $entity_type_bundle_info, $time); + public function __construct(EntityRepositoryInterface $entity_repository, LanguageManagerInterface $language_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) { + parent::__construct($entity_repository, $entity_type_bundle_info, $time); $this->languageManager = $language_manager; } @@ -50,7 +50,7 @@ abstract class AccountForm extends ContentEntityForm { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager'), + $container->get('entity.repository'), $container->get('language_manager'), $container->get('entity_type.bundle.info'), $container->get('datetime.time') @@ -161,7 +161,7 @@ abstract class AccountForm extends ContentEntityForm { // When not building the user registration form, prevent web browsers from // autofilling/prefilling the email, username, and password fields. - if ($this->getOperation() != 'register') { + if (!$register) { foreach (['mail', 'name', 'pass'] as $key) { if (isset($form['account'][$key])) { $form['account'][$key]['#attributes']['autocomplete'] = 'off'; @@ -347,7 +347,7 @@ abstract class AccountForm extends ContentEntityForm { 'timezone', 'langcode', 'preferred_langcode', - 'preferred_admin_langcode' + 'preferred_admin_langcode', ], parent::getEditedFieldNames($form_state)); } @@ -365,7 +365,7 @@ abstract class AccountForm extends ContentEntityForm { 'timezone', 'langcode', 'preferred_langcode', - 'preferred_admin_langcode' + 'preferred_admin_langcode', ]; foreach ($violations->getByFields($field_names) as $violation) { list($field_name) = explode('.', $violation->getPropertyPath(), 2);