diff --git a/core/includes/update.inc b/core/includes/update.inc index 90f3051..5449fc0 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -44,6 +44,7 @@ function update_check_incompatibility($name, $type = 'module') { // We need to do a full rebuild here to make sure the database reflects any // code changes that were made in the filesystem before the update script // was initiated. + \Drupal::moduleHandler()->load('system'); $themes = system_rebuild_theme_data(); $modules = system_rebuild_module_data(); } diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index 42002b1..2950eb2 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -11,6 +11,8 @@ /** * Denotes that a feed's items should never expire. + * + * @deprecated Use \Drupal\aggregator\Entity\Feed::CLEAR_NEVER instead. */ const AGGREGATOR_CLEAR_NEVER = 0; diff --git a/core/modules/aggregator/src/Entity/Feed.php b/core/modules/aggregator/src/Entity/Feed.php index 6532f36..87f7d6e 100644 --- a/core/modules/aggregator/src/Entity/Feed.php +++ b/core/modules/aggregator/src/Entity/Feed.php @@ -50,6 +50,11 @@ class Feed extends ContentEntityBase implements FeedInterface { /** + * Denotes that a feed's items should never expire. + */ + const CLEAR_NEVER = 0; + + /** * Implements Drupal\Core\Entity\EntityInterface::label(). */ public function label() { @@ -167,7 +172,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { $intervals = array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200); $period = array_map(array(\Drupal::service('date.formatter'), 'formatInterval'), array_combine($intervals, $intervals)); - $period[AGGREGATOR_CLEAR_NEVER] = t('Never'); + $period[static::CLEAR_NEVER] = t('Never'); $fields['refresh'] = BaseFieldDefinition::create('list_integer') ->setLabel(t('Update interval')) diff --git a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php index 9b2d82d..eecee53 100644 --- a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php +++ b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php @@ -29,6 +29,7 @@ class LanguageConfigurationElementTest extends WebTestBase { * Tests the language settings have been saved. */ public function testLanguageConfigurationElement() { + \Drupal::moduleHandler()->load('language'); $this->drupalGet('language-tests/language_configuration_element'); $edit['lang_configuration[langcode]'] = 'current_interface'; $edit['lang_configuration[language_show]'] = FALSE; diff --git a/core/modules/system/src/Tests/Ajax/DialogTest.php b/core/modules/system/src/Tests/Ajax/DialogTest.php index 867ed11..8d256fe 100644 --- a/core/modules/system/src/Tests/Ajax/DialogTest.php +++ b/core/modules/system/src/Tests/Ajax/DialogTest.php @@ -30,6 +30,7 @@ public function testDialog() { $this->drupalGet('ajax-test/dialog'); // Set up variables for this test. + \Drupal::moduleHandler()->load('ajax_test'); $dialog_renderable = ajax_test_dialog_contents(); $dialog_contents = drupal_render($dialog_renderable); $modal_expected_response = array( diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module index 226223a..870a157 100644 --- a/core/modules/system/tests/modules/ajax_test/ajax_test.module +++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module @@ -13,3 +13,121 @@ use Drupal\Core\Ajax\HtmlCommand; use Drupal\Core\Url; +/** + * Menu callback: Returns an element suitable for use by + * \Drupal\Core\Ajax\AjaxResponse::ajaxRender(). + * + * Additionally ensures that \Drupal\Core\Ajax\AjaxResponse::ajaxRender() + * incorporates JavaScript settings generated during the page request by + * invoking _drupal_add_js() with a dummy setting. + * + * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::render() + */ +function ajax_test_render() { + $attached = array( + '#attached' => array( + 'js' => array( + 0 => array( + 'type' => 'setting', + 'data' => array('ajax' => 'test'), + ), + ), + ), + ); + // @todo Why is this being tested via an explicit drupal_render() call? + drupal_render($attached); + drupal_process_attached($attached); + $response = new AjaxResponse(); + return $response; +} + +/** + * Menu callback: Returns an AjaxResponse; settings command set last. + * + * Helps verifying AjaxResponse reorders commands to ensure correct execution. + * + * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::order() + */ +function ajax_test_order() { + $response = new AjaxResponse(); + $path = drupal_get_path('module', 'system'); + // HTML insertion command. + $response->addCommand(new HtmlCommand('body', 'Hello, world!')); + $attached = array( + '#attached' => array( + 'css' => array( + // Add two CSS files (order should remain the same). + $path . '/css/system.admin.css' => array(), + $path . '/css/system.maintenance.css' => array(), + ), + 'js' => array( + // Add two JavaScript files (first to the footer, should appear last). + $path . '/system.modules.js' => array('scope' => 'footer'), + $path . '/system.js' => array(), + // Finally, add a JavaScript setting. + 0 => array( + 'type' => 'setting', + 'data' => array('ajax' => 'test'), + ), + ), + ), + ); + + // @todo Why is this being tested via an explicit drupal_render() call? + drupal_render($attached); + drupal_process_attached($attached); + + return $response; +} + +/** + * Menu callback: Returns AJAX element with #error property set. + * + * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::renderError() + */ +function ajax_test_error() { + $message = ''; + $query = \Drupal::request()->query; + if ($query->has('message')) { + $message = $query->get('message'); + } + $response = new AjaxResponse(); + $response->addCommand(new AlertCommand($message)); + return $response; +} + +/** + * Returns example content for dialog tests. + */ +function ajax_test_dialog_contents() { + // This is a regular render array; the keys do not have special meaning. + $content = array( + '#title' => 'AJAX Dialog contents', + 'content' => array( + '#markup' => 'Example message', + ), + 'cancel' => array( + '#type' => 'link', + '#title' => 'Cancel', + '#url' => Url::fromRoute(''), + '#attributes' => array( + // This is a special class to which JavaScript assigns dialog closing + // behavior. + 'class' => array('dialog-cancel'), + ), + ), + ); + + return $content; +} + +/** + * Menu callback: Close the ajax dialog. + * + * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::dialogClose() + */ +function ajax_test_dialog_close() { + $response = new AjaxResponse(); + $response->addCommand(new CloseDialogCommand('#ajax-test-dialog-wrapper-1')); + return $response; +} diff --git a/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php b/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php index f74ef2d..80bada9 100644 --- a/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php +++ b/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php @@ -34,6 +34,7 @@ public function testRedirect() { * A redirect response if the batch is progressive. No return value otherwise. */ public function testLargePercentage() { + \Drupal::moduleHandler()->load('batch_test'); batch_test_stack(NULL, TRUE); batch_set(_batch_test_batch_5()); @@ -65,6 +66,7 @@ public function testNestedDrupalFormSubmit($value = 1) { * A redirect response if the batch is progressive. No return value otherwise. */ public function testNoForm() { + \Drupal::moduleHandler()->load('batch_test'); batch_test_stack(NULL, TRUE); batch_set(_batch_test_batch_1()); diff --git a/core/modules/system/tests/modules/database_test/database_test.module b/core/modules/system/tests/modules/database_test/database_test.module index 685a7d7..c10cce8 100644 --- a/core/modules/system/tests/modules/database_test/database_test.module +++ b/core/modules/system/tests/modules/database_test/database_test.module @@ -1,7 +1,6 @@ range(); } - -/** - * Runs db_query_temporary() and outputs the table name and its number of rows. - * - * We need to test that the table created is temporary, so we run it here, in a - * separate menu callback request; After this request is done, the temporary - * table should automatically dropped. - * - * @deprecated \Drupal\database_test\Controller\DatabaseTestController::dbQueryTemporary() - */ -function database_test_db_query_temporary() { - $table_name = db_query_temporary('SELECT age FROM {test}', array()); - return new JsonResponse(array( - 'table_name' => $table_name, - 'row_count' => db_select($table_name)->countQuery()->execute()->fetchField(), - )); -} - -/** - * Runs a pager query and returns the results. - * - * This function does care about the page GET parameter, as set by the - * simpletest HTTP call. - * - * @deprecated \Drupal\database_test\Controller\DatabaseTestController::pagerQueryEven() - */ -function database_test_even_pager_query($limit) { - - $query = db_select('test', 't'); - $query - ->fields('t', array('name')) - ->orderBy('age'); - - // This should result in 2 pages of results. - $query = $query - ->extend('Drupal\Core\Database\Query\PagerSelectExtender') - ->limit($limit); - - $names = $query->execute()->fetchCol(); - - return new JsonResponse(array( - 'names' => $names, - )); -} - -/** - * Runs a pager query and returns the results. - * - * This function does care about the page GET parameter, as set by the - * simpletest HTTP call. - * - * @deprecated \Drupal\database_test\Controller\DatabaseTestController::pagerQueryOdd() - */ -function database_test_odd_pager_query($limit) { - - $query = db_select('test_task', 't'); - $query - ->fields('t', array('task')) - ->orderBy('pid'); - - // This should result in 4 pages of results. - $query = $query - ->extend('Drupal\Core\Database\Query\PagerSelectExtender') - ->limit($limit); - - $names = $query->execute()->fetchCol(); - - return new JsonResponse(array( - 'names' => $names, - )); -} - -/** - * Runs a tablesort query and returns the results. - * - * This function does care about the page GET parameter, as set by the - * simpletest HTTP call. - * - * @deprecated \Drupal\database_test\Controller\DatabaseTestController::testTablesort() - */ -function database_test_tablesort() { - $header = array( - 'tid' => array('data' => t('Task ID'), 'field' => 'tid', 'sort' => 'desc'), - 'pid' => array('data' => t('Person ID'), 'field' => 'pid'), - 'task' => array('data' => t('Task'), 'field' => 'task'), - 'priority' => array('data' => t('Priority'), 'field' => 'priority', ), - ); - - $query = db_select('test_task', 't'); - $query - ->fields('t', array('tid', 'pid', 'task', 'priority')); - - $query = $query - ->extend('Drupal\Core\Database\Query\TableSortExtender') - ->orderByHeader($header); - - // We need all the results at once to check the sort. - $tasks = $query->execute()->fetchAll(); - - return new JsonResponse(array( - 'tasks' => $tasks, - )); -} - -/** - * Runs a tablesort query with a second order_by after and returns the results. - * - * This function does care about the page GET parameter, as set by the - * simpletest HTTP call. - * - * @deprecated \Drupal\database_test\Controller\DatabaseTestController::testTablesortFirst() - */ -function database_test_tablesort_first() { - $header = array( - 'tid' => array('data' => t('Task ID'), 'field' => 'tid', 'sort' => 'desc'), - 'pid' => array('data' => t('Person ID'), 'field' => 'pid'), - 'task' => array('data' => t('Task'), 'field' => 'task'), - 'priority' => array('data' => t('Priority'), 'field' => 'priority', ), - ); - - $query = db_select('test_task', 't'); - $query - ->fields('t', array('tid', 'pid', 'task', 'priority')); - - $query = $query - ->extend('Drupal\Core\Database\Query\TableSortExtender') - ->orderByHeader($header) - ->orderBy('priority'); - - // We need all the results at once to check the sort. - $tasks = $query->execute()->fetchAll(); - - return new JsonResponse(array( - 'tasks' => $tasks, - )); -} - diff --git a/core/modules/system/tests/modules/database_test/src/Controller/DatabaseTestController.php b/core/modules/system/tests/modules/database_test/src/Controller/DatabaseTestController.php index 23687d3..f7493b7 100644 --- a/core/modules/system/tests/modules/database_test/src/Controller/DatabaseTestController.php +++ b/core/modules/system/tests/modules/database_test/src/Controller/DatabaseTestController.php @@ -7,44 +7,135 @@ namespace Drupal\database_test\Controller; +use Symfony\Component\HttpFoundation\JsonResponse; + /** * Controller routines for database_test routes. */ class DatabaseTestController { /** - * @todo Remove database_test_db_query_temporary(). + * Runs db_query_temporary() and outputs the table name and its number of rows. + * + * We need to test that the table created is temporary, so we run it here, in a + * separate menu callback request; After this request is done, the temporary + * table should automatically dropped. */ public function dbQueryTemporary() { - return database_test_db_query_temporary(); + $table_name = db_query_temporary('SELECT age FROM {test}', array()); + return new JsonResponse(array( + 'table_name' => $table_name, + 'row_count' => db_select($table_name)->countQuery()->execute()->fetchField(), + )); } /** - * @todo Remove database_test_even_pager_query(). + * Runs a pager query and returns the results. + * + * This function does care about the page GET parameter, as set by the + * simpletest HTTP call. */ public function pagerQueryEven($limit) { - return database_test_even_pager_query($limit); + $query = db_select('test', 't'); + $query + ->fields('t', array('name')) + ->orderBy('age'); + + // This should result in 2 pages of results. + $query = $query + ->extend('Drupal\Core\Database\Query\PagerSelectExtender') + ->limit($limit); + + $names = $query->execute()->fetchCol(); + + return new JsonResponse(array( + 'names' => $names, + )); } /** - * @todo Remove database_test_odd_pager_query(). + * Runs a pager query and returns the results. + * + * This function does care about the page GET parameter, as set by the + * simpletest HTTP call. */ public function pagerQueryOdd($limit) { - return database_test_odd_pager_query($limit); + $query = db_select('test_task', 't'); + $query + ->fields('t', array('task')) + ->orderBy('pid'); + + // This should result in 4 pages of results. + $query = $query + ->extend('Drupal\Core\Database\Query\PagerSelectExtender') + ->limit($limit); + + $names = $query->execute()->fetchCol(); + + return new JsonResponse(array( + 'names' => $names, + )); } /** - * @todo Remove database_test_tablesort(). + * Runs a tablesort query and returns the results. + * + * This function does care about the page GET parameter, as set by the + * simpletest HTTP call. */ public function testTablesort() { - return database_test_tablesort(); + $header = array( + 'tid' => array('data' => t('Task ID'), 'field' => 'tid', 'sort' => 'desc'), + 'pid' => array('data' => t('Person ID'), 'field' => 'pid'), + 'task' => array('data' => t('Task'), 'field' => 'task'), + 'priority' => array('data' => t('Priority'), 'field' => 'priority', ), + ); + + $query = db_select('test_task', 't'); + $query + ->fields('t', array('tid', 'pid', 'task', 'priority')); + + $query = $query + ->extend('Drupal\Core\Database\Query\TableSortExtender') + ->orderByHeader($header); + + // We need all the results at once to check the sort. + $tasks = $query->execute()->fetchAll(); + + return new JsonResponse(array( + 'tasks' => $tasks, + )); } /** - * @todo Remove database_test_tablesort_first(). + * Runs a tablesort query with a second order_by after and returns the results. + * + * This function does care about the page GET parameter, as set by the + * simpletest HTTP call. */ public function testTablesortFirst() { - return database_test_tablesort_first(); + $header = array( + 'tid' => array('data' => t('Task ID'), 'field' => 'tid', 'sort' => 'desc'), + 'pid' => array('data' => t('Person ID'), 'field' => 'pid'), + 'task' => array('data' => t('Task'), 'field' => 'task'), + 'priority' => array('data' => t('Priority'), 'field' => 'priority', ), + ); + + $query = db_select('test_task', 't'); + $query + ->fields('t', array('tid', 'pid', 'task', 'priority')); + + $query = $query + ->extend('Drupal\Core\Database\Query\TableSortExtender') + ->orderByHeader($header) + ->orderBy('priority'); + + // We need all the results at once to check the sort. + $tasks = $query->execute()->fetchAll(); + + return new JsonResponse(array( + 'tasks' => $tasks, + )); } } diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php index f618c92..dcc135b 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php @@ -29,6 +29,7 @@ * A form with a tableselect element and a submit button. */ function tableselectFormBuilder($form, FormStateInterface $form_state, $element_properties) { + \Drupal::moduleHandler()->load('form_test'); list($header, $options) = _form_test_tableselect_get_data(); $form['tableselect'] = $element_properties; diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index e0387bf..0ba540d 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -81,32 +81,6 @@ function menu_test_menu_local_tasks_alter(&$data, $route_name) { } /** - * Page callback: Tests the theme negotiation functionality. - * - * @param bool $inherited - * (optional) TRUE when the requested page is intended to inherit - * the theme of its parent. - * - * @return string - * A string describing the requested custom theme and actual theme being used - * for the current page request. - * - * @see menu_test_menu(). - * - * @deprecated Use \Drupal\menu_test\Controller\MenuTestController::themePage() - */ -function menu_test_theme_page_callback($inherited = FALSE) { - $theme_key = \Drupal::theme()->getActiveTheme()->getName(); - // Now we check what the theme negotiator service returns. - $active_theme = \Drupal::service('theme.negotiator')->determineActiveTheme(\Drupal::routeMatch()); - $output = "Active theme: $active_theme. Actual theme: $theme_key."; - if ($inherited) { - $output .= ' Theme negotiation inheritance is being tested.'; - } - return $output; -} - -/** * Sets a static variable for the testMenuName() test. * * Used to change the menu_name parameter of a menu. @@ -125,19 +99,3 @@ function menu_test_menu_name($new_name = '') { return $menu_name; } -/** - * Title callback: Concatenates the title and case number. - * - * @param string $title - * Title string. - * @param int $case_number - * (optional) The current case number which it tests (defaults to 3). - * - * @return string - * A string containing the title and case number. - * - * @see menu_test_menu(). - */ -function menu_test_title_callback($title, $case_number = 3) { - return t($title) . ' - Case ' . $case_number; -} diff --git a/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php b/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php index 3ae72ec..04b4f60 100644 --- a/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php +++ b/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php @@ -41,10 +41,27 @@ public function titleCallback(array $_title_arguments = array(), $_title = '') { } /** - * @todo Remove menu_test_theme_page_callback(). + * Page callback: Tests the theme negotiation functionality. + * + * @param bool $inherited + * (optional) TRUE when the requested page is intended to inherit + * the theme of its parent. + * + * @return string + * A string describing the requested custom theme and actual theme being used + * for the current page request. + * + * @see menu_test.routing.yml */ public function themePage($inherited) { - return menu_test_theme_page_callback($inherited); + $theme_key = \Drupal::theme()->getActiveTheme()->getName(); + // Now we check what the theme negotiator service returns. + $active_theme = \Drupal::service('theme.negotiator')->determineActiveTheme(\Drupal::routeMatch()); + $output = "Active theme: $active_theme. Actual theme: $theme_key."; + if ($inherited) { + $output .= ' Theme negotiation inheritance is being tested.'; + } + return $output; } /** diff --git a/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php b/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php index 644dd49..2c8185c 100644 --- a/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php +++ b/core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php @@ -9,6 +9,7 @@ use Drupal\Core\PathProcessor\InboundPathProcessorInterface; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; +use Drupal\user\Entity\User; use Symfony\Component\HttpFoundation\Request; /** @@ -22,7 +23,11 @@ class PathProcessorTest implements InboundPathProcessorInterface, OutboundPathPr public function processInbound($path, Request $request) { // Rewrite user/username to user/uid. if (preg_match('!^user/([^/]+)(/.*)?!', $path, $matches)) { - if ($account = user_load_by_name($matches[1])) { + $accounts = \Drupal::entityManager() + ->getStorage('user') + ->loadByProperties(array('name' => $matches[1])); + + if ($account = reset($accounts)) { $matches += array(2 => ''); $path = 'user/' . $account->id() . $matches[2]; } @@ -45,7 +50,7 @@ public function processInbound($path, Request $request) { public function processOutbound($path, &$options = array(), Request $request = NULL) { // Rewrite user/uid to user/username. if (preg_match('!^user/([0-9]+)(/.*)?!', $path, $matches)) { - if ($account = user_load($matches[1])) { + if ($account = User::load($matches[1])) { $matches += array(2 => ''); $path = 'user/' . $account->getUsername() . $matches[2]; } diff --git a/core/modules/taxonomy/src/Entity/Vocabulary.php b/core/modules/taxonomy/src/Entity/Vocabulary.php index e650551..350cbd9 100644 --- a/core/modules/taxonomy/src/Entity/Vocabulary.php +++ b/core/modules/taxonomy/src/Entity/Vocabulary.php @@ -48,6 +48,21 @@ class Vocabulary extends ConfigEntityBundleBase implements VocabularyInterface { use ThirdPartySettingsTrait; /** + * Denotes that no term in the vocabulary has a parent. + */ + const HIERARCHY_DISABLED = 0; + + /** + * Denotes that one or more terms in the vocabulary has a single parent. + */ + const HIERARCHY_SINGLE = 1; + + /** + * Denotes that one or more terms in the vocabulary have multiple parents. + */ + const HIERARCHY_MULTIPLE = 2; + + /** * The taxonomy vocabulary ID. * * @var string @@ -72,13 +87,13 @@ class Vocabulary extends ConfigEntityBundleBase implements VocabularyInterface { * The type of hierarchy allowed within the vocabulary. * * Possible values: - * - TAXONOMY_HIERARCHY_DISABLED: No parents. - * - TAXONOMY_HIERARCHY_SINGLE: Single parent. - * - TAXONOMY_HIERARCHY_MULTIPLE: Multiple parents. + * - Vocabulary::HIERARCHY_DISABLED: No parents. + * - Vocabulary::HIERARCHY_SINGLE: Single parent. + * - Vocabulary::HIERARCHY_MULTIPLE: Multiple parents. * * @var integer */ - public $hierarchy = TAXONOMY_HIERARCHY_DISABLED; + public $hierarchy = Vocabulary::HIERARCHY_DISABLED; /** * The weight of this vocabulary in relation to other vocabularies. diff --git a/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php b/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php index 03d2184..c2c9ec8 100644 --- a/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php +++ b/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php @@ -6,13 +6,14 @@ */ namespace Drupal\update_test\Controller; +use Drupal\Core\Controller\ControllerBase; use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\Response; /** * Provides different routes of the update_test module. */ -class UpdateTestController { +class UpdateTestController extends ControllerBase { /** diff --git a/core/modules/user/src/Access/RegisterAccessCheck.php b/core/modules/user/src/Access/RegisterAccessCheck.php index 0f0a3f5..501e3a8 100644 --- a/core/modules/user/src/Access/RegisterAccessCheck.php +++ b/core/modules/user/src/Access/RegisterAccessCheck.php @@ -27,6 +27,6 @@ class RegisterAccessCheck implements AccessInterface { */ public function access(AccountInterface $account) { // @todo cacheable per role once https://www.drupal.org/node/2040135 lands. - return AccessResult::allowedIf($account->isAnonymous() && \Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY)->setCacheable(FALSE); + return AccessResult::allowedIf($account->isAnonymous() && \Drupal::config('user.settings')->get('register') != 'admin_only')->setCacheable(FALSE); } } diff --git a/core/modules/user/src/Form/UserPasswordForm.php b/core/modules/user/src/Form/UserPasswordForm.php index f06ba29..146f5aa 100644 --- a/core/modules/user/src/Form/UserPasswordForm.php +++ b/core/modules/user/src/Form/UserPasswordForm.php @@ -76,7 +76,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'textfield', '#title' => $this->t('Username or email address'), '#size' => 60, - '#maxlength' => max(USERNAME_MAX_LENGTH, Email::EMAIL_MAX_LENGTH), + '#maxlength' => max(60, Email::EMAIL_MAX_LENGTH), + //'#maxlength' => max(USERNAME_MAX_LENGTH, Email::EMAIL_MAX_LENGTH), '#required' => TRUE, '#attributes' => array( 'autocorrect' => 'off',