diff --git a/d7/sites/all/modules/contrib/location/location.module b/d7/sites/all/modules/contrib/location/location.module index a0a3ea84..cf9dad4d 100644 --- a/d7/sites/all/modules/contrib/location/location.module +++ b/d7/sites/all/modules/contrib/location/location.module @@ -185,6 +185,8 @@ function location_element_info() { } /** + * PORTED to Dmaps 8.x-1.x - dmaps_entity_extra_field_info(); + * * Implements hook_field_extra_fields(). */ function location_field_extra_fields() { diff --git a/d8/.eslintrc b/d8/.eslintrc index 0ebfd5a8..9c0e3e69 100644 --- a/d8/.eslintrc +++ b/d8/.eslintrc @@ -1,97 +1,3 @@ { - "extends": "eslint:recommended", - "env": { - "browser": true - }, - "globals": { - "Drupal": true, - "drupalSettings": true, - "drupalTranslations": true, - "domready": true, - "jQuery": true, - "_": true, - "matchMedia": true, - "Backbone": true, - "Modernizr": true, - "CKEDITOR": true - }, - "rules": { - // Errors. - "array-bracket-spacing": [2, "never"], - "block-scoped-var": 2, - "brace-style": [2, "stroustrup", {"allowSingleLine": true}], - "comma-dangle": [2, "never"], - "comma-spacing": 2, - "comma-style": [2, "last"], - "computed-property-spacing": [2, "never"], - "curly": [2, "all"], - "eol-last": 2, - "eqeqeq": [2, "smart"], - "guard-for-in": 2, - "indent": [2, 2, {"SwitchCase": 1}], - "key-spacing": [2, {"beforeColon": false, "afterColon": true}], - "linebreak-style": [2, "unix"], - "lines-around-comment": [2, {"beforeBlockComment": true, "afterBlockComment": false}], - "new-parens": 2, - "no-array-constructor": 2, - "no-caller": 2, - "no-catch-shadow": 2, - "no-empty-label": 2, - "no-eval": 2, - "no-extend-native": 2, - "no-extra-bind": 2, - "no-extra-parens": [2, "functions"], - "no-implied-eval": 2, - "no-iterator": 2, - "no-label-var": 2, - "no-labels": 2, - "no-lone-blocks": 2, - "no-loop-func": 2, - "no-multi-spaces": 2, - "no-multi-str": 2, - "no-native-reassign": 2, - "no-nested-ternary": 2, - "no-new-func": 2, - "no-new-object": 2, - "no-new-wrappers": 2, - "no-octal-escape": 2, - "no-process-exit": 2, - "no-proto": 2, - "no-return-assign": 2, - "no-script-url": 2, - "no-sequences": 2, - "no-shadow-restricted-names": 2, - "no-spaced-func": 2, - "no-trailing-spaces": 2, - "no-undef-init": 2, - "no-undefined": 2, - "no-unused-expressions": 2, - "no-unused-vars": [2, {"vars": "all", "args": "none"}], - "no-with": 2, - "object-curly-spacing": [2, "never"], - "one-var": [2, "never"], - "quote-props": [2, "consistent-as-needed"], - "quotes": [2, "single", "avoid-escape"], - "semi": [2, "always"], - "semi-spacing": [2, {"before": false, "after": true}], - "space-after-keywords": [2, "always"], - "space-before-blocks": [2, "always"], - "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}], - "space-in-parens": [2, "never"], - "space-infix-ops": 2, - "space-return-throw-case": 2, - "space-unary-ops": [2, { "words": true, "nonwords": false }], - "spaced-comment": [2, "always"], - "strict": 2, - "yoda": [2, "never"], - // Warnings. - "max-nested-callbacks": [1, 3], - "valid-jsdoc": [1, { - "prefer": { - "returns": "return", - "property": "prop" - }, - "requireReturn": false - }] - } + "extends": "./core/.eslintrc" } diff --git a/d8/.htaccess b/d8/.htaccess index 01c63af9..974999a9 100644 --- a/d8/.htaccess +++ b/d8/.htaccess @@ -3,7 +3,7 @@ # # Protect files and directories from prying eyes. - + Require all denied diff --git a/d8/composer.lock b/d8/composer.lock index 32535367..a406a5d0 100644 --- a/d8/composer.lock +++ b/d8/composer.lock @@ -2627,23 +2627,23 @@ }, { "name": "jcalderonzumba/mink-phantomjs-driver", - "version": "dev-master", + "version": "v0.3.1", "source": { "type": "git", "url": "https://github.com/jcalderonzumba/MinkPhantomJSDriver.git", - "reference": "10d7c48c9a4129463052321b52450d98983c4332" + "reference": "782892dbea4af7d04024374672b3790b6c008def" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jcalderonzumba/MinkPhantomJSDriver/zipball/10d7c48c9a4129463052321b52450d98983c4332", - "reference": "10d7c48c9a4129463052321b52450d98983c4332", + "url": "https://api.github.com/repos/jcalderonzumba/MinkPhantomJSDriver/zipball/782892dbea4af7d04024374672b3790b6c008def", + "reference": "782892dbea4af7d04024374672b3790b6c008def", "shasum": "" }, "require": { "behat/mink": "~1.6", "jcalderonzumba/gastonjs": "~1.0", "php": ">=5.4", - "twig/twig": "~1.8" + "twig/twig": "~1.20|~2.0" }, "require-dev": { "phpunit/phpunit": "~4.6", @@ -2684,7 +2684,7 @@ "phantomjs", "testing" ], - "time": "2015-10-05 18:24:44" + "time": "2015-12-04 13:55:02" }, { "name": "mikey179/vfsStream", @@ -3740,39 +3740,7 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { - "php": 0, - "symfony/class-loader": 0, - "symfony/console": 0, - "symfony/dependency-injection": 0, - "symfony/event-dispatcher": 0, - "symfony/http-foundation": 0, - "symfony/http-kernel": 0, - "symfony/routing": 0, - "symfony/serializer": 0, - "symfony/translation": 0, - "symfony/validator": 0, - "symfony/process": 0, - "symfony/yaml": 0, - "twig/twig": 0, - "doctrine/common": 0, - "doctrine/annotations": 0, - "guzzlehttp/guzzle": 0, - "symfony-cmf/routing": 0, - "easyrdf/easyrdf": 0, - "zendframework/zend-feed": 0, - "stack/builder": 0, - "egulias/email-validator": 0, - "masterminds/html5": 0, - "symfony/psr-http-message-bridge": 0, - "zendframework/zend-diactoros": 0, - "composer/semver": 0, - "behat/mink": 0, - "behat/mink-goutte-driver": 0, - "jcalderonzumba/gastonjs": 20, - "jcalderonzumba/mink-phantomjs-driver": 20, - "mikey179/vfsstream": 0, - "phpunit/phpunit": 0, - "symfony/css-selector": 0 + "jcalderonzumba/gastonjs": 20 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/d8/core/.eslintrc b/d8/core/.eslintrc new file mode 100644 index 00000000..0ebfd5a8 --- /dev/null +++ b/d8/core/.eslintrc @@ -0,0 +1,97 @@ +{ + "extends": "eslint:recommended", + "env": { + "browser": true + }, + "globals": { + "Drupal": true, + "drupalSettings": true, + "drupalTranslations": true, + "domready": true, + "jQuery": true, + "_": true, + "matchMedia": true, + "Backbone": true, + "Modernizr": true, + "CKEDITOR": true + }, + "rules": { + // Errors. + "array-bracket-spacing": [2, "never"], + "block-scoped-var": 2, + "brace-style": [2, "stroustrup", {"allowSingleLine": true}], + "comma-dangle": [2, "never"], + "comma-spacing": 2, + "comma-style": [2, "last"], + "computed-property-spacing": [2, "never"], + "curly": [2, "all"], + "eol-last": 2, + "eqeqeq": [2, "smart"], + "guard-for-in": 2, + "indent": [2, 2, {"SwitchCase": 1}], + "key-spacing": [2, {"beforeColon": false, "afterColon": true}], + "linebreak-style": [2, "unix"], + "lines-around-comment": [2, {"beforeBlockComment": true, "afterBlockComment": false}], + "new-parens": 2, + "no-array-constructor": 2, + "no-caller": 2, + "no-catch-shadow": 2, + "no-empty-label": 2, + "no-eval": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-parens": [2, "functions"], + "no-implied-eval": 2, + "no-iterator": 2, + "no-label-var": 2, + "no-labels": 2, + "no-lone-blocks": 2, + "no-loop-func": 2, + "no-multi-spaces": 2, + "no-multi-str": 2, + "no-native-reassign": 2, + "no-nested-ternary": 2, + "no-new-func": 2, + "no-new-object": 2, + "no-new-wrappers": 2, + "no-octal-escape": 2, + "no-process-exit": 2, + "no-proto": 2, + "no-return-assign": 2, + "no-script-url": 2, + "no-sequences": 2, + "no-shadow-restricted-names": 2, + "no-spaced-func": 2, + "no-trailing-spaces": 2, + "no-undef-init": 2, + "no-undefined": 2, + "no-unused-expressions": 2, + "no-unused-vars": [2, {"vars": "all", "args": "none"}], + "no-with": 2, + "object-curly-spacing": [2, "never"], + "one-var": [2, "never"], + "quote-props": [2, "consistent-as-needed"], + "quotes": [2, "single", "avoid-escape"], + "semi": [2, "always"], + "semi-spacing": [2, {"before": false, "after": true}], + "space-after-keywords": [2, "always"], + "space-before-blocks": [2, "always"], + "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}], + "space-in-parens": [2, "never"], + "space-infix-ops": 2, + "space-return-throw-case": 2, + "space-unary-ops": [2, { "words": true, "nonwords": false }], + "spaced-comment": [2, "always"], + "strict": 2, + "yoda": [2, "never"], + // Warnings. + "max-nested-callbacks": [1, 3], + "valid-jsdoc": [1, { + "prefer": { + "returns": "return", + "property": "prop" + }, + "requireReturn": false + }] + } +} diff --git a/d8/core/CHANGELOG.txt b/d8/core/CHANGELOG.txt index 6b8e812d..01a3dd48 100644 --- a/d8/core/CHANGELOG.txt +++ b/d8/core/CHANGELOG.txt @@ -341,7 +341,7 @@ Drupal 7.0, 2011-01-05 - Improved time zone support: * Drupal now uses PHP's time zone database when rendering dates in local time. Site-wide and user-configured time zone offsets have been converted - to time zone names, e.g. Africa/Abidjan. + to time zone names; for example, Africa/Abidjan. * In some cases the upgrade and install scripts do not choose the preferred site default time zone. The automatically-selected time zone can be corrected at admin/config/regional/settings. @@ -399,7 +399,7 @@ Drupal 7.0, 2011-01-05 preserved but renamed to file_unmanaged_*(). * Rewrote file handling to use PHP stream wrappers to enable support for both public and private files and to support pluggable storage mechanisms - and access to remote resources (e.g. S3 storage or Flickr photos). + and access to remote resources (for example, S3 storage or Flickr photos). * The mime_extension_mapping variable has been removed. Modules that need to alter the default MIME type extension mappings should implement hook_file_mimetype_mapping_alter(). @@ -816,7 +816,7 @@ Drupal 4.7.0, 2006-05-01 - Added support for PHP5's 'mysqli' extension. - Search module: * Made indexer smarter and more robust. - * Added advanced search operators (e.g., phrase, node type, etc.). + * Added advanced search operators (phrase, node type, etc.). * Added customizable result ranking. - PostgreSQL support: * Removed dependency on PL/pgSQL procedural language. diff --git a/d8/core/MAINTAINERS.txt b/d8/core/MAINTAINERS.txt index 1fa3118a..18556e33 100644 --- a/d8/core/MAINTAINERS.txt +++ b/d8/core/MAINTAINERS.txt @@ -87,7 +87,6 @@ Cron system CSS - John Albin Wilkins 'JohnAlbin' https://www.drupal.org/u/johnalbin -- Lewis Nyman 'LewisNyman' https://www.drupal.org/u/lewisnyman Database system - Larry Garfield 'Crell' https://www.drupal.org/u/crell @@ -486,7 +485,10 @@ Classy theme - Morten Birch Heide-Jørgensen 'mortendk' https://www.drupal.org/u/mortendk Seven theme -- Lewis Nyman 'LewisNyman' https://www.drupal.org/u/lewisnyman +- ? + +Stable theme +- Scott Reeves 'Cottser' https://www.drupal.org/u/cottser Stark theme - John Albin Wilkins 'JohnAlbin' https://www.drupal.org/u/johnalbin diff --git a/d8/core/composer.json b/d8/core/composer.json index afb170ad..1eabf49e 100644 --- a/d8/core/composer.json +++ b/d8/core/composer.json @@ -35,7 +35,7 @@ "behat/mink": "~1.6", "behat/mink-goutte-driver": "~1.2", "jcalderonzumba/gastonjs": "^1.1@dev", - "jcalderonzumba/mink-phantomjs-driver": "dev-master#10d7c48c9a4129463052321b52450d98983c4332", + "jcalderonzumba/mink-phantomjs-driver": "~0.3.1", "mikey179/vfsStream": "~1.2", "phpunit/phpunit": "~4.8", "symfony/css-selector": "2.7.*" diff --git a/d8/core/config/schema/core.data_types.schema.yml b/d8/core/config/schema/core.data_types.schema.yml index 3edb8057..4ab0fd76 100644 --- a/d8/core/config/schema/core.data_types.schema.yml +++ b/d8/core/config/schema/core.data_types.schema.yml @@ -87,12 +87,22 @@ color_hex: # Complex extended data types: # Root of a configuration object. + +_core_config_info: + type: mapping + mapping: + default_config_hash: + type: string + label: 'Default configuration hash' + config_object: type: mapping mapping: langcode: type: string label: 'Language code' + _core: + type: _core_config_info # Mail text with subject and body parts. mail: @@ -281,6 +291,8 @@ config_entity: label: 'Third party settings' sequence: type: '[%parent.%parent.%type].third_party.[%key]' + _core: + type: _core_config_info block_settings: type: mapping diff --git a/d8/core/core.api.php b/d8/core/core.api.php index 962a0c01..ef04faf2 100644 --- a/d8/core/core.api.php +++ b/d8/core/core.api.php @@ -344,7 +344,7 @@ * Configuration entity classes expose dependencies by overriding the * \Drupal\Core\Config\Entity\ConfigEntityInterface::calculateDependencies() * method. - * - On routes for paths staring with '/admin' or otherwise designated as + * - On routes for paths starting with '/admin' or otherwise designated as * administration paths (such as node editing when it is set as an admin * operation), if they have configuration entity placeholders, configuration * entities are normally loaded in their original language, without @@ -567,7 +567,7 @@ * * By default cached data is stored in the database. This can be configured * though so that all cached data, or that of an individual cache bin, uses a - * different cache backend, such as APC or Memcache, for storage. + * different cache backend, such as APCu or Memcache, for storage. * * In a settings.php file, you can override the service used for a particular * cache bin. For example, if your service implementation of @@ -692,7 +692,7 @@ * "service" (such as accessing the database, sending email, or translating user * interface text) is defined (given a name and an interface or at least a * class that defines the methods that may be called), and a default class is - * defined to provide the service. These two steps must be done together, and + * designated to provide the service. These two steps must be done together, and * can be done by Drupal Core or a module. Other modules can then define * alternative classes to provide the same services, overriding the default * classes. Classes and functions that need to use the service should always @@ -843,6 +843,32 @@ * @} */ +/** + * @defgroup listing_page_service Page header for Services page + * @{ + * Introduction to services + * + * A "service" (such as accessing the database, sending email, or translating + * user interface text) can be defined by a module or Drupal core. Defining a + * service means giving it a name and designating a default class to provide the + * service; ideally, there should also be an interface that defines the methods + * that may be called. Services are collected into the Dependency Injection + * Container, and can be overridden to use different classes or different + * instantiation by modules. See the + * @link container Services and Dependency Injection Container topic @endlink + * for details. + * + * Some services have tags, which are defined in the service definition. Tags + * are used to define a group of related services, or to specify some aspect of + * how the service behaves. See the + * @link service_tag Service Tags topic @endlink for more information. + * + * @see container + * @see service_tag + * + * @} + */ + /** * @defgroup typed_data Typed Data API * @{ @@ -1441,6 +1467,38 @@ * @} */ +/** + * @defgroup listing_page_class Page header for Classes page + * @{ + * Introduction to classes + * + * A lot of the PHP code in Drupal is object oriented (OO), making use of + * @link http://php.net/manual/language.oop5.php PHP classes, interfaces, and traits. @endlink + * See the + * @link oo_conventions Objected-oriented programming conventions @endlink + * for more information. + * + * @see oo_conventions + * + * @} + */ + +/** + * @defgroup listing_page_namespace Page header for Namespaces page + * @{ + * Introduction to namespaces + * + * PHP classes, interfaces, and traits in Drupal are + * @link http://php.net/manual/en/language.namespaces.rationale.php namespaced. @endlink + * See the + * @link oo_conventions Objected-oriented programming conventions @endlink + * for more information. + * + * @see oo_conventions + * + * @} + */ + /** * @defgroup best_practices Best practices for developers * @{ @@ -1667,16 +1725,13 @@ * _form: '\Drupal\mymodule\Form\ExampleForm' * @endcode * - * The $form argument to form-related functions is a structured array containing - * the elements and properties of the form. For information on the array - * components and format, and more detailed explanations of the Form API - * workflow, see the - * @link forms_api_reference.html Form API reference @endlink - * and the + * The $form argument to form-related functions is a specialized render array + * containing the elements and properties of the form. For more about render + * arrays, see the @link theme_render Render API topic. @endlink For more + * detailed explanations of the Form API workflow, see the * @link https://www.drupal.org/node/2117411 Form API documentation section. @endlink - * In addition, there is a set of Form API tutorials in - * @link form_example_tutorial.inc the Form Example Tutorial @endlink which - * provide basics all the way up through multistep forms. + * In addition, there is a set of Form API tutorials in the + * @link https://www.drupal.org/project/examples Examples for Developers project. @endlink * * In the form builder, validation, submission, and other form methods, * $form_state is the primary influence on the processing of the form and is diff --git a/d8/core/includes/batch.inc b/d8/core/includes/batch.inc index 6d0c8356..a4b5378d 100644 --- a/d8/core/includes/batch.inc +++ b/d8/core/includes/batch.inc @@ -203,7 +203,7 @@ function _batch_progress_page() { * exceeded. It will continue with the next operation of the same batch set in * the next request. * - * @return + * @return array * An array containing a completion value (in percent) and a status message. */ function _batch_process() { @@ -337,15 +337,15 @@ function _batch_process() { /** * Formats the percent completion for a batch set. * - * @param $total + * @param int $total * The total number of operations. - * @param $current + * @param int|float $current * The number of the current operation. This may be a floating point number * rather than an integer in the case of a multi-step operation that is not * yet complete; in that case, the fractional part of $current represents the * fraction of the operation that has been completed. * - * @return + * @return string * The properly formatted percentage, as a string. We output percentages * using the correct number of decimal places so that we never print "100%" * until we are finished, but we also never print more decimal places than @@ -372,8 +372,9 @@ function &_batch_current_set() { * process and execute its form submit handler (if defined), which may add * further sets to this batch. * - * @return - * TRUE if a subsequent set was found in the batch. + * @return true|null + * TRUE if a subsequent set was found in the batch; no value will be returned + * if no subsequent set was found. */ function _batch_next_set() { $batch = &batch_get(); diff --git a/d8/core/includes/database.inc b/d8/core/includes/database.inc index 477e8437..ff03885a 100644 --- a/d8/core/includes/database.inc +++ b/d8/core/includes/database.inc @@ -32,8 +32,8 @@ use Drupal\Core\Site\Settings; * The prepared statement query to run. Although it will accept both named and * unnamed placeholders, named placeholders are strongly preferred as they are * more self-documenting. If the argument corresponding to a placeholder is - * an array of values to be expanded, e.g. for an IN query, the placeholder - * should be named with a trailing bracket like :example[] + * an array of values to be expanded (for example, with an IN query), the + * placeholder should be named with a trailing bracket like :example[]. * @param array $args * An array of values to substitute into the query. If the query uses named * placeholders, this is an associative array in any order. If the query uses @@ -47,7 +47,7 @@ use Drupal\Core\Site\Settings; * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call query() on it. E.g. + * call query() on it. For example, * $injected_database->query($query, $args, $options); * * @see \Drupal\Core\Database\Connection::query() @@ -85,7 +85,7 @@ function db_query($query, array $args = array(), array $options = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call queryRange() on it. E.g. + * call queryRange() on it. For example, * $injected_database->queryRange($query, $from, $count, $args, $options); * * @see \Drupal\Core\Database\Connection::queryRange() @@ -121,7 +121,7 @@ function db_query_range($query, $from, $count, array $args = array(), array $opt * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call queryTemporary() on it. E.g. + * call queryTemporary() on it. For example, * $injected_database->queryTemporary($query, $args, $options); * * @see \Drupal\Core\Database\Connection::queryTemporary() @@ -148,7 +148,8 @@ function db_query_temporary($query, array $args = array(), array $options = arra * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call insert() on it. E.g. $injected_database->insert($table, $options); + * call insert() on it. For example, + * $injected_database->insert($table, $options); * * @see \Drupal\Core\Database\Connection::insert() * @see \Drupal\Core\Database\Connection::defaultOptions() @@ -173,7 +174,8 @@ function db_insert($table, array $options = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call merge() on it. E.g. $injected_database->merge($table, $options); + * call merge() on it. For example, + * $injected_database->merge($table, $options); * * @see \Drupal\Core\Database\Connection::merge() * @see \Drupal\Core\Database\Connection::defaultOptions() @@ -198,7 +200,8 @@ function db_merge($table, array $options = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call update() on it. E.g. $injected_database->update($table, $options); + * call update() on it. For example, + * $injected_database->update($table, $options); * * @see \Drupal\Core\Database\Connection::update() * @see \Drupal\Core\Database\Connection::defaultOptions() @@ -223,7 +226,8 @@ function db_update($table, array $options = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call delete() on it. E.g. $injected_database->delete($table, $options); + * call delete() on it. For example, + * $injected_database->delete($table, $options); * * @see \Drupal\Core\Database\Connection::delete() * @see \Drupal\Core\Database\Connection::defaultOptions() @@ -248,7 +252,8 @@ function db_delete($table, array $options = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call truncate() on it. E.g. $injected_database->truncate($table, $options); + * call truncate() on it. For example, + * $injected_database->truncate($table, $options); * * @see \Drupal\Core\Database\Connection::truncate() * @see \Drupal\Core\Database\Connection::defaultOptions() @@ -277,7 +282,7 @@ function db_truncate($table, array $options = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call select() on it. E.g. + * call select() on it. For example, * $injected_database->select($table, $alias, $options); * * @see \Drupal\Core\Database\Connection::select() @@ -304,7 +309,7 @@ function db_select($table, $alias = NULL, array $options = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call startTransaction() on it. E.g. + * call startTransaction() on it. For example, * $injected_database->startTransaction($name); * * @see \Drupal\Core\Database\Connection::startTransaction() @@ -346,7 +351,8 @@ function db_set_active($key = 'default') { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call escapeTable() on it. E.g. $injected_database->escapeTable($table); + * call escapeTable() on it. For example, + * $injected_database->escapeTable($table); * * @see \Drupal\Core\Database\Connection::escapeTable() */ @@ -367,7 +373,8 @@ function db_escape_table($table) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call escapeTable() on it. E.g. $injected_database->escapeTable($table); + * call escapeTable() on it. For example, + * $injected_database->escapeTable($table); * * @see \Drupal\Core\Database\Connection::escapeField() */ @@ -407,7 +414,8 @@ function db_escape_field($field) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call escapeLike() on it. E.g. $injected_database->escapeLike($string); + * call escapeLike() on it. For example, + * $injected_database->escapeLike($string); * * @see \Drupal\Core\Database\Connection::escapeLike() */ @@ -423,7 +431,7 @@ function db_like($string) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call driver() on it. E.g. $injected_database->driver($string); + * call driver() on it. For example, $injected_database->driver($string); * * @see \Drupal\Core\Database\Connection::driver() */ @@ -467,7 +475,7 @@ function db_close(array $options = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container and - * call nextId() on it. E.g. $injected_database->nextId($existing_id); + * call nextId() on it. For example, $injected_database->nextId($existing_id); * * @see \Drupal\Core\Database\Connection::nextId() */ @@ -565,7 +573,7 @@ function db_condition($conjunction) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call createTable() on it. E.g. + * its schema driver, and call createTable() on it. For example, * $injected_database->schema()->createTable($name, $table); * * @see \Drupal\Core\Database\Schema::createTable() @@ -588,7 +596,7 @@ function db_create_table($name, $table) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call fieldNames() on it. E.g. + * its schema driver, and call fieldNames() on it. For example, * $injected_database->schema()->fieldNames($fields); * * @see \Drupal\Core\Database\Schema::fieldNames() @@ -610,7 +618,7 @@ function db_field_names($fields) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call indexExists() on it. E.g. + * its schema driver, and call indexExists() on it. For example, * $injected_database->schema()->indexExists($table, $name); * * @see \Drupal\Core\Database\Schema::indexExists() @@ -630,7 +638,7 @@ function db_index_exists($table, $name) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call tableExists() on it. E.g. + * its schema driver, and call tableExists() on it. For example, * $injected_database->schema()->tableExists($table); * * @see \Drupal\Core\Database\Schema::tableExists() @@ -652,7 +660,7 @@ function db_table_exists($table) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call fieldExists() on it. E.g. + * its schema driver, and call fieldExists() on it. For example, * $injected_database->schema()->fieldExists($table, $field); * * @see \Drupal\Core\Database\Schema::fieldExists() @@ -672,7 +680,7 @@ function db_field_exists($table, $field) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call findTables() on it. E.g. + * its schema driver, and call findTables() on it. For example, * $injected_database->schema()->findTables($table_expression); * * @see \Drupal\Core\Database\Schema::findTables() @@ -691,7 +699,7 @@ function db_find_tables($table_expression) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call renameTable() on it. E.g. + * its schema driver, and call renameTable() on it. For example, * $injected_database->schema()->renameTable($table, $new_name); * * @see \Drupal\Core\Database\Schema::renameTable() @@ -708,7 +716,7 @@ function db_rename_table($table, $new_name) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call dropTable() on it. E.g. + * its schema driver, and call dropTable() on it. For example, * $injected_database->schema()->dropTable($table); * * @see \Drupal\Core\Database\Schema::dropTable() @@ -738,7 +746,7 @@ function db_drop_table($table) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call addField() on it. E.g. + * its schema driver, and call addField() on it. For example, * $injected_database->schema()->addField($table, $field, $spec, $keys_new); * * @see \Drupal\Core\Database\Schema::addField() @@ -762,7 +770,7 @@ function db_add_field($table, $field, $spec, $keys_new = array()) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call dropField() on it. E.g. + * its schema driver, and call dropField() on it. For example, * $injected_database->schema()->dropField($table, $field); * * @see \Drupal\Core\Database\Schema::dropField() @@ -783,7 +791,7 @@ function db_drop_field($table, $field) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call fieldSetDefault() on it. E.g. + * its schema driver, and call fieldSetDefault() on it. For example, * $injected_database->schema()->fieldSetDefault($table, $field, $default); * * @see \Drupal\Core\Database\Schema::fieldSetDefault() @@ -802,7 +810,7 @@ function db_field_set_default($table, $field, $default) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call fieldSetNoDefault() on it. E.g. + * its schema driver, and call fieldSetNoDefault() on it. For example, * $injected_database->schema()->fieldSetNoDefault($table, $field); * * @see \Drupal\Core\Database\Schema::fieldSetNoDefault() @@ -821,7 +829,7 @@ function db_field_set_no_default($table, $field) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call addPrimaryKey() on it. E.g. + * its schema driver, and call addPrimaryKey() on it. For example, * $injected_database->schema()->addPrimaryKey($table, $fields); * * @see \Drupal\Core\Database\Schema::addPrimaryKey() @@ -842,7 +850,7 @@ function db_add_primary_key($table, $fields) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call dropPrimaryKey() on it. E.g. + * its schema driver, and call dropPrimaryKey() on it. For example, * $injected_database->schema()->dropPrimaryKey($table); * * @see \Drupal\Core\Database\Schema::dropPrimaryKey() @@ -863,7 +871,7 @@ function db_drop_primary_key($table) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call addUniqueKey() on it. E.g. + * its schema driver, and call addUniqueKey() on it. For example, * $injected_database->schema()->addUniqueKey($table, $name, $fields); * * @see \Drupal\Core\Database\Schema::addUniqueKey() @@ -886,7 +894,7 @@ function db_add_unique_key($table, $name, $fields) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call dropUniqueKey() on it. E.g. + * its schema driver, and call dropUniqueKey() on it. For example, * $injected_database->schema()->dropUniqueKey($table, $name); * * @see \Drupal\Core\Database\Schema::dropUniqueKey() @@ -911,7 +919,7 @@ function db_drop_unique_key($table, $name) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call addIndex() on it. E.g. + * its schema driver, and call addIndex() on it. For example, * $injected_database->schema()->addIndex($table, $name, $fields, $spec); * * @see hook_schema() @@ -936,7 +944,7 @@ function db_add_index($table, $name, $fields, array $spec) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call dropIndex() on it. E.g. + * its schema driver, and call dropIndex() on it. For example, * $injected_database->schema()->dropIndex($table, $name); * * @see \Drupal\Core\Database\Schema::dropIndex() @@ -1007,7 +1015,7 @@ function db_drop_index($table, $name) { * * @deprecated as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get * a database connection injected into your service from the container, get - * its schema driver, and call changeField() on it. E.g. + * its schema driver, and call changeField() on it. For example, * $injected_database->schema()->changeField($table, $field, $field_new, $spec, $keys_new); * * @see \Drupal\Core\Database\Schema::changeField() diff --git a/d8/core/includes/theme.inc b/d8/core/includes/theme.inc index 5da67fb0..25cc7c47 100644 --- a/d8/core/includes/theme.inc +++ b/d8/core/includes/theme.inc @@ -328,10 +328,10 @@ function theme_get_setting($setting_name, $theme = NULL) { // Generate the path to the logo image. if ($cache[$theme]->get('logo.use_default')) { - $cache[$theme]->set('logo.url', file_create_url($theme_object->getPath() . '/logo.svg')); + $cache[$theme]->set('logo.url', file_url_transform_relative(file_create_url($theme_object->getPath() . '/logo.svg'))); } elseif ($logo_path = $cache[$theme]->get('logo.path')) { - $cache[$theme]->set('logo.url', file_create_url($logo_path)); + $cache[$theme]->set('logo.url', file_url_transform_relative(file_create_url($logo_path))); } // Generate the path to the favicon. @@ -339,14 +339,14 @@ function theme_get_setting($setting_name, $theme = NULL) { $favicon_path = $cache[$theme]->get('favicon.path'); if ($cache[$theme]->get('favicon.use_default')) { if (file_exists($favicon = $theme_object->getPath() . '/favicon.ico')) { - $cache[$theme]->set('favicon.url', file_create_url($favicon)); + $cache[$theme]->set('favicon.url', file_url_transform_relative(file_create_url($favicon))); } else { - $cache[$theme]->set('favicon.url', file_create_url('core/misc/favicon.ico')); + $cache[$theme]->set('favicon.url', file_url_transform_relative(file_create_url('core/misc/favicon.ico'))); } } elseif ($favicon_path) { - $cache[$theme]->set('favicon.url', file_create_url($favicon_path)); + $cache[$theme]->set('favicon.url', file_url_transform_relative(file_create_url($favicon_path))); } else { $cache[$theme]->set('features.favicon', FALSE); @@ -727,7 +727,8 @@ function template_preprocess_links(&$variables) { * to an empty string, but can be set to NULL for the attribute to be * omitted. Usually, neither omission nor an empty string satisfies * accessibility requirements, so it is strongly encouraged for code - * calling _theme('image') to pass a meaningful value for this variable. + * building variables for image.html.twig templates to pass a meaningful + * value for this variable. * - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 * - http://www.w3.org/TR/xhtml1/dtds.html * - http://dev.w3.org/html5/spec/Overview.html#alt @@ -740,7 +741,7 @@ function template_preprocess_links(&$variables) { */ function template_preprocess_image(&$variables) { if (!empty($variables['uri'])) { - $variables['attributes']['src'] = file_create_url($variables['uri']); + $variables['attributes']['src'] = file_url_transform_relative(file_create_url($variables['uri'])); } // Generate a srcset attribute conforming to the spec at // http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#attr-img-srcset @@ -748,7 +749,7 @@ function template_preprocess_image(&$variables) { $srcset = array(); foreach ($variables['srcset'] as $src) { // URI is mandatory. - $source = file_create_url($src['uri']); + $source = file_url_transform_relative(file_create_url($src['uri'])); if (isset($src['width']) && !empty($src['width'])) { $source .= ' ' . $src['width']; } @@ -1519,7 +1520,7 @@ function template_preprocess_field(&$variables, $hook) { } // Merge attributes when a single-value field has a hidden label. - if ($element['#label_display'] == 'hidden' && !$variables['multiple']) { + if ($element['#label_display'] == 'hidden' && !$variables['multiple'] && !empty($element['#items'][0]->_attributes)) { $variables['attributes'] = NestedArray::mergeDeep($variables['attributes'], (array) $element['#items'][0]->_attributes); } @@ -1721,11 +1722,12 @@ function drupal_common_theme() { 'image' => array( // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft // allows the alt attribute to be omitted in some cases. Therefore, - // default the alt attribute to an empty string, but allow code calling - // _theme('image') to pass explicit NULL for it to be omitted. Usually, - // neither omission nor an empty string satisfies accessibility - // requirements, so it is strongly encouraged for code calling - // _theme('image') to pass a meaningful value for the alt variable. + // default the alt attribute to an empty string, but allow code providing + // variables to image.html.twig templates to pass explicit NULL for it to + // be omitted. Usually, neither omission nor an empty string satisfies + // accessibility requirements, so it is strongly encouraged for code + // building variables for image.html.twig templates to pass a meaningful + // value for the alt variable. // - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 // - http://www.w3.org/TR/xhtml1/dtds.html // - http://dev.w3.org/html5/spec/Overview.html#alt @@ -1765,7 +1767,7 @@ function drupal_common_theme() { 'render element' => 'page', ), 'maintenance_task_list' => array( - 'variables' => array('items' => NULL, 'active' => NULL, 'variant' => NULL), + 'variables' => array('items' => NULL, 'active' => NULL, 'variant' => NULL), ), 'authorize_report' => array( 'variables' => ['messages' => [], 'attributes' => []], diff --git a/d8/core/install.php b/d8/core/install.php index 5940fbeb..50deb38f 100644 --- a/d8/core/install.php +++ b/d8/core/install.php @@ -7,6 +7,8 @@ // Change the directory to the Drupal root. chdir('..'); +// Store the Drupal root path. +$root_path = realpath(''); /** * Global flag to indicate the site is in installation mode. @@ -26,7 +28,12 @@ exit; } +if (function_exists('opcache_get_status') && opcache_get_status()['opcache_enabled'] && !ini_get('opcache.save_comments')) { + print 'Systems with OPcache installed must have opcache.save_comments enabled.'; + exit(); +} + // Start the installer. -$class_loader = require_once 'autoload.php'; -require_once __DIR__ . '/includes/install.core.inc'; +$class_loader = require_once $root_path . '/autoload.php'; +require_once $root_path . '/core/includes/install.core.inc'; install_drupal($class_loader); diff --git a/d8/core/lib/Drupal.php b/d8/core/lib/Drupal.php index b955142c..16231e93 100644 --- a/d8/core/lib/Drupal.php +++ b/d8/core/lib/Drupal.php @@ -63,8 +63,8 @@ * class StuffDoingClass implements StuffDoingInterface { * protected $lockBackend; * - * public function __construct(LockBackendInterface $lockBackend) { - * $this->lockBackend = $lockBackend; + * public function __construct(LockBackendInterface $lock_backend) { + * $this->lockBackend = $lock_backend; * } * * public function doStuff() { @@ -81,7 +81,7 @@ class Drupal { /** * The current system version. */ - const VERSION = '8.0.1'; + const VERSION = '8.0.3'; /** * Core API compatibility. @@ -423,11 +423,11 @@ public static function httpClient() { * Returns the entity query object for this entity type. * * @param string $entity_type - * The entity type, e.g. node, for which the query object should be + * The entity type (for example, node) for which the query object should be * returned. * @param string $conjunction - * AND if all conditions in the query need to apply, OR if any of them is - * enough. Optional, defaults to AND. + * (optional) Either 'AND' if all conditions in the query need to apply, or + * 'OR' if any of them is sufficient. Defaults to 'AND'. * * @return \Drupal\Core\Entity\Query\QueryInterface * The query object that can query the given entity type. @@ -440,11 +440,11 @@ public static function entityQuery($entity_type, $conjunction = 'AND') { * Returns the entity query aggregate object for this entity type. * * @param string $entity_type - * The entity type, e.g. node, for which the query object should be + * The entity type (for example, node) for which the query object should be * returned. * @param string $conjunction - * AND if all conditions in the query need to apply, OR if any of them is - * enough. Optional, defaults to AND. + * (optional) Either 'AND' if all conditions in the query need to apply, or + * 'OR' if any of them is sufficient. Defaults to 'AND'. * * @return \Drupal\Core\Entity\Query\QueryAggregateInterface * The query object that can query the given entity type. diff --git a/d8/core/lib/Drupal/Component/FileCache/ApcuFileCacheBackend.php b/d8/core/lib/Drupal/Component/FileCache/ApcuFileCacheBackend.php index 25b60975..b82e1acf 100644 --- a/d8/core/lib/Drupal/Component/FileCache/ApcuFileCacheBackend.php +++ b/d8/core/lib/Drupal/Component/FileCache/ApcuFileCacheBackend.php @@ -16,21 +16,21 @@ class ApcuFileCacheBackend implements FileCacheBackendInterface { * {@inheritdoc} */ public function fetch(array $cids) { - return apc_fetch($cids); + return apcu_fetch($cids); } /** * {@inheritdoc} */ public function store($cid, $data) { - apc_store($cid, $data); + apcu_store($cid, $data); } /** * {@inheritdoc} */ public function delete($cid) { - apc_delete($cid); + apcu_delete($cid); } } diff --git a/d8/core/lib/Drupal/Component/Gettext/PoHeader.php b/d8/core/lib/Drupal/Component/Gettext/PoHeader.php index aa8ea201..ebd366ff 100644 --- a/d8/core/lib/Drupal/Component/Gettext/PoHeader.php +++ b/d8/core/lib/Drupal/Component/Gettext/PoHeader.php @@ -471,10 +471,10 @@ private function tokenizeFormula($formula) { * * @param array $element_stack * Array of plural formula values and operators create by parseArithmetic(). - * @param integer $n + * @param int $n * The @count number for which we are determining the right plural position. * - * @return integer + * @return int * Number of the plural string to be used for the given plural value. * * @see parseArithmetic() diff --git a/d8/core/lib/Drupal/Component/Utility/Number.php b/d8/core/lib/Drupal/Component/Utility/Number.php index 453ed4ab..99bedc87 100644 --- a/d8/core/lib/Drupal/Component/Utility/Number.php +++ b/d8/core/lib/Drupal/Component/Utility/Number.php @@ -21,11 +21,11 @@ class Number { * * This is based on the number/range verification methods of webkit. * - * @param numeric $value + * @param float $value * The value that needs to be checked. - * @param numeric $step + * @param float $step * The step scale factor. Must be positive. - * @param numeric $offset + * @param float $offset * (optional) An offset, to which the difference must be a multiple of the * given step. * diff --git a/d8/core/lib/Drupal/Component/Utility/OpCodeCache.php b/d8/core/lib/Drupal/Component/Utility/OpCodeCache.php index 90b28e7e..576f3bd0 100644 --- a/d8/core/lib/Drupal/Component/Utility/OpCodeCache.php +++ b/d8/core/lib/Drupal/Component/Utility/OpCodeCache.php @@ -30,16 +30,6 @@ public static function invalidate($pathname) { if (function_exists('opcache_invalidate')) { opcache_invalidate($pathname, TRUE); } - // If apcu extension is enabled in PHP 5.5 or greater it emulates apc. - // This is to provide an easy upgrade path if you are using apc's user - // caching however the emulation does not extend to opcode caching. - // Therefore we need to check if the function exists as well. - if (extension_loaded('apc') && function_exists('apc_delete_file')) { - // apc_delete_file() throws a PHP warning in case the specified file was - // not compiled yet. - // @see http://php.net/manual/en/function.apc-delete-file.php - @apc_delete_file($pathname); - } } } diff --git a/d8/core/lib/Drupal/Component/Utility/UrlHelper.php b/d8/core/lib/Drupal/Component/Utility/UrlHelper.php index 1763c236..9166b34a 100644 --- a/d8/core/lib/Drupal/Component/Utility/UrlHelper.php +++ b/d8/core/lib/Drupal/Component/Utility/UrlHelper.php @@ -36,10 +36,11 @@ class UrlHelper { * http_build_query() directly. * * @param array $query - * The query parameter array to be processed, - * e.g. \Drupal::request()->query->all(). + * The query parameter array to be processed; for instance, + * \Drupal::request()->query->all(). * @param string $parent - * Internal use only. Used to build the $query array key for nested items. + * (optional) Internal use only. Used to build the $query array key for + * nested items. Defaults to an empty string. * * @return string * A rawurlencoded string which can be used as or appended to the URL query @@ -168,8 +169,8 @@ public static function parse($url) { } // Internal URLs. else { - // parse_url() does not support relative URLs, so make it absolute. E.g. the - // relative URL "foo/bar:1" isn't properly parsed. + // parse_url() does not support relative URLs, so make it absolute. For + // instance, the relative URL "foo/bar:1" isn't properly parsed. $parts = parse_url('http://example.com/' . $url); // Strip the leading slash that was just added. $options['path'] = substr($parts['path'], 1); @@ -200,10 +201,11 @@ public static function encodePath($path) { } /** - * Determines whether a path is external to Drupal (e.g. http://example.com). + * Determines whether a path is external to Drupal. * - * If a path cannot be assessed by Drupal's menu handler, then we must - * treat it as potentially insecure. + * An example of an external path is http://example.com. If a path cannot be + * assessed by Drupal's menu handler, then we must treat it as potentially + * insecure. * * @param string $path * The internal path or external URL being linked to, such as "node/34" or @@ -296,7 +298,7 @@ public static function setAllowedProtocols(array $protocols = array()) { } /** - * Strips dangerous protocols (e.g. 'javascript:') from a URI. + * Strips dangerous protocols (for example, 'javascript:') from a URI. * * This function must be called for all URIs within user-entered input prior * to being output to an HTML attribute value. It is often called as part of @@ -316,8 +318,8 @@ public static function setAllowedProtocols(array $protocols = array()) { * for well-formed URLs will be invoked, which strips most substrings that * precede a ":". The result can be used in URL attributes such as "href" * or "src" (only after calling Html::escape() separately), but this may not - * produce valid HTML (e.g., malformed URLs within "href" attributes fail - * HTML validation). This can be avoided by using + * produce valid HTML (for example, malformed URLs within "href" attributes + * fail HTML validation). This can be avoided by using * Url::fromUri($possibly_not_a_url)->toString(), which either throws an * exception or returns a well-formed URL. * diff --git a/d8/core/lib/Drupal/Core/Access/CustomAccessCheck.php b/d8/core/lib/Drupal/Core/Access/CustomAccessCheck.php index fb2ccddb..3722d232 100644 --- a/d8/core/lib/Drupal/Core/Access/CustomAccessCheck.php +++ b/d8/core/lib/Drupal/Core/Access/CustomAccessCheck.php @@ -55,6 +55,8 @@ public function __construct(ControllerResolverInterface $controller_resolver, Ac /** * Checks access for the account and route using the custom access checker. * + * @param \Symfony\Component\Routing\Route $route + * The route. * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * The route match object to be checked. * @param \Drupal\Core\Session\AccountInterface $account diff --git a/d8/core/lib/Drupal/Core/Annotation/QueueWorker.php b/d8/core/lib/Drupal/Core/Annotation/QueueWorker.php index 85a2296f..89150c5d 100644 --- a/d8/core/lib/Drupal/Core/Annotation/QueueWorker.php +++ b/d8/core/lib/Drupal/Core/Annotation/QueueWorker.php @@ -10,18 +10,21 @@ use Drupal\Component\Annotation\Plugin; /** - * Declare queue workers that need to be run periodically. + * Declare a worker class for processing a queue item. * - * While there can be only one hook_cron() process running at the same time, - * there can be any number of processes defined here running. Because of - * this, long running tasks are much better suited for this API. Items queued - * in hook_cron() might be processed in the same cron run if there are not many - * items in the queue, otherwise it might take several requests, which can be - * run in parallel. + * Worker plugins are used by some queues for processing the individual items + * in the queue. In that case, the ID of the worker plugin needs to match the + * machine name of a queue, so that you can retrieve the queue back end by + * calling \Drupal\Core\Queue\QueueFactory::get($plugin_id). * - * You can create queues, add items to them, claim them, etc. without using a - * QueueWorker plugin if you want, however, you need to take care of processing - * the items in the queue in that case. See \Drupal\Core\Cron for an example. + * \Drupal\Core\Cron::processQueues() processes queues that use workers; they + * can also be processed outside of the cron process. + * + * Some queues do not use worker plugins: you can create queues, add items to + * them, claim them, etc. without using a QueueWorker plugin. However, you will + * need to take care of processing the items in the queue in that case. You can + * look at \Drupal\Core\Cron::processQueues() for an example of how to process + * a queue that uses workers, and adapt it to your queue. * * Plugin Namespace: Plugin\QueueWorker * diff --git a/d8/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php b/d8/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php index 49e4675e..0f70dbf5 100644 --- a/d8/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php +++ b/d8/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php @@ -135,7 +135,7 @@ public function render(array $css_assets) { // assets: output a LINK tag for a file CSS asset. if (count($css_assets) <= 31) { $element = $link_element_defaults; - $element['#attributes']['href'] = file_create_url($css_asset['data']) . $query_string_separator . $query_string; + $element['#attributes']['href'] = file_url_transform_relative(file_create_url($css_asset['data'])) . $query_string_separator . $query_string; $element['#attributes']['media'] = $css_asset['media']; $element['#browsers'] = $css_asset['browsers']; $elements[] = $element; @@ -148,7 +148,7 @@ public function render(array $css_assets) { // LINK tag. if (!$css_asset['preprocess']) { $element = $link_element_defaults; - $element['#attributes']['href'] = file_create_url($css_asset['data']) . $query_string_separator . $query_string; + $element['#attributes']['href'] = file_url_transform_relative(file_create_url($css_asset['data'])) . $query_string_separator . $query_string; $element['#attributes']['media'] = $css_asset['media']; $element['#browsers'] = $css_asset['browsers']; $elements[] = $element; @@ -168,7 +168,7 @@ public function render(array $css_assets) { // control browser-caching. IE7 does not support a media type on // the @import statement, so we instead specify the media for // the group on the STYLE tag. - $import[] = '@import url("' . Html::escape(file_create_url($next_css_asset['data']) . '?' . $query_string) . '");'; + $import[] = '@import url("' . Html::escape(file_url_transform_relative(file_create_url($next_css_asset['data'])) . '?' . $query_string) . '");'; // Move the outer for loop skip the next item, since we // processed it here. $i = $j; diff --git a/d8/core/lib/Drupal/Core/Asset/CssOptimizer.php b/d8/core/lib/Drupal/Core/Asset/CssOptimizer.php index dc34a237..704ee571 100644 --- a/d8/core/lib/Drupal/Core/Asset/CssOptimizer.php +++ b/d8/core/lib/Drupal/Core/Asset/CssOptimizer.php @@ -265,7 +265,7 @@ public function rewriteFileURI($matches) { $last = $path; $path = preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $path); } - return 'url(' . file_create_url($path) . ')'; + return 'url(' . file_url_transform_relative(file_create_url($path)) . ')'; } } diff --git a/d8/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php b/d8/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php index 70832e9d..b0d22f15 100644 --- a/d8/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php +++ b/d8/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php @@ -79,7 +79,7 @@ public function render(array $js_assets) { case 'file': $query_string = $js_asset['version'] == -1 ? $default_query_string : 'v=' . $js_asset['version']; $query_string_separator = (strpos($js_asset['data'], '?') !== FALSE) ? '&' : '?'; - $element['#attributes']['src'] = file_create_url($js_asset['data']); + $element['#attributes']['src'] = file_url_transform_relative(file_create_url($js_asset['data'])); // Only add the cache-busting query string if this isn't an aggregate // file. if (!isset($js_asset['preprocessed'])) { diff --git a/d8/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php b/d8/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php index a4ec3361..a5a0ad3a 100644 --- a/d8/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php +++ b/d8/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php @@ -51,14 +51,14 @@ class LibraryDiscoveryCollector extends CacheCollector { /** * Constructs a CacheCollector object. * - * @param string $cid - * The cid for the array being cached. * @param \Drupal\Core\Cache\CacheBackendInterface $cache * The cache backend. * @param \Drupal\Core\Lock\LockBackendInterface $lock * The lock backend. * @param \Drupal\Core\Asset\LibraryDiscoveryParser $discovery_parser * The library discovery parser. + * @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager + * The theme manager. */ public function __construct(CacheBackendInterface $cache, LockBackendInterface $lock, LibraryDiscoveryParser $discovery_parser, ThemeManagerInterface $theme_manager) { $this->themeManager = $theme_manager; diff --git a/d8/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/d8/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php index 9d6e796e..f25b7b03 100644 --- a/d8/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +++ b/d8/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php @@ -50,6 +50,8 @@ class LibraryDiscoveryParser { * The app root. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. + * @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager + * The theme manager. */ public function __construct($root, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager) { $this->root = $root; diff --git a/d8/core/lib/Drupal/Core/Authentication/AuthenticationProviderFilterInterface.php b/d8/core/lib/Drupal/Core/Authentication/AuthenticationProviderFilterInterface.php index 99f8e105..002d5204 100644 --- a/d8/core/lib/Drupal/Core/Authentication/AuthenticationProviderFilterInterface.php +++ b/d8/core/lib/Drupal/Core/Authentication/AuthenticationProviderFilterInterface.php @@ -13,8 +13,9 @@ * Restrict authentication methods to a subset of the site. * * Some authentication methods should not be available throughout a whole site. - * E.g., there are good reasons to restrict insecure methods like HTTP basic - * auth or an URL token authentication method to API-only routes. + * For instance, there are good reasons to restrict insecure methods like HTTP + * basic authentication or an URL token authentication method to API-only + * routes. */ interface AuthenticationProviderFilterInterface { diff --git a/d8/core/lib/Drupal/Core/Cache/Apcu4Backend.php b/d8/core/lib/Drupal/Core/Cache/Apcu4Backend.php new file mode 100644 index 00000000..537d5848 --- /dev/null +++ b/d8/core/lib/Drupal/Core/Cache/Apcu4Backend.php @@ -0,0 +1,26 @@ += 4.0.0 and < 5.0.0. + */ +class Apcu4Backend extends ApcuBackend { + + /** + * {@inheritdoc} + * + * @return \APCIterator + */ + protected function getIterator($search = NULL, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE) { + return new \APCIterator('user', $search, $format, $chunk_size, $list); + } + +} diff --git a/d8/core/lib/Drupal/Core/Cache/ApcuBackend.php b/d8/core/lib/Drupal/Core/Cache/ApcuBackend.php index b64fd717..4d7a4d76 100644 --- a/d8/core/lib/Drupal/Core/Cache/ApcuBackend.php +++ b/d8/core/lib/Drupal/Core/Cache/ApcuBackend.php @@ -60,7 +60,7 @@ public function __construct($bin, $site_prefix, CacheTagsChecksumInterface $chec } /** - * Prepends the APC user variable prefix for this bin to a cache item ID. + * Prepends the APCu user variable prefix for this bin to a cache item ID. * * @param string $cid * The cache item ID to prefix. @@ -76,7 +76,7 @@ public function getApcuKey($cid) { * {@inheritdoc} */ public function get($cid, $allow_invalid = FALSE) { - $cache = apc_fetch($this->getApcuKey($cid)); + $cache = apcu_fetch($this->getApcuKey($cid)); return $this->prepareItem($cache, $allow_invalid); } @@ -90,7 +90,7 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) { $map[$this->getApcuKey($cid)] = $cid; } - $result = apc_fetch(array_keys($map)); + $result = apcu_fetch(array_keys($map)); $cache = array(); if ($result) { foreach ($result as $key => $item) { @@ -112,18 +112,18 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) { * APCu is a memory cache, shared across all server processes. To prevent * cache item clashes with other applications/installations, every cache item * is prefixed with a unique string for this site. Therefore, functions like - * apc_clear_cache() cannot be used, and instead, a list of all cache items + * apcu_clear_cache() cannot be used, and instead, a list of all cache items * belonging to this application need to be retrieved through this method * instead. * * @param string $prefix * (optional) A cache ID prefix to limit the result to. * - * @return \APCIterator - * An APCIterator containing matched items. + * @return \APCUIterator + * An APCUIterator containing matched items. */ protected function getAll($prefix = '') { - return new \APCIterator('user', '/^' . preg_quote($this->getApcuKey($prefix), '/') . '/'); + return $this->getIterator('/^' . preg_quote($this->getApcuKey($prefix), '/') . '/'); } /** @@ -174,12 +174,12 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN $cache->expire = $expire; $cache->tags = implode(' ', $tags); $cache->checksum = $this->checksumProvider->getCurrentChecksum($tags); - // APC serializes/unserializes any structure itself. + // APCu serializes/unserializes any structure itself. $cache->serialized = 0; $cache->data = $data; // Expiration is handled by our own prepareItem(), not APCu. - apc_store($this->getApcuKey($cid), $cache); + apcu_store($this->getApcuKey($cid), $cache); } /** @@ -195,35 +195,35 @@ public function setMultiple(array $items = array()) { * {@inheritdoc} */ public function delete($cid) { - apc_delete($this->getApcuKey($cid)); + apcu_delete($this->getApcuKey($cid)); } /** * {@inheritdoc} */ public function deleteMultiple(array $cids) { - apc_delete(array_map(array($this, 'getApcuKey'), $cids)); + apcu_delete(array_map(array($this, 'getApcuKey'), $cids)); } /** * {@inheritdoc} */ public function deleteAll() { - apc_delete(new \APCIterator('user', '/^' . preg_quote($this->binPrefix, '/') . '/')); + apcu_delete($this->getIterator('/^' . preg_quote($this->binPrefix, '/') . '/')); } /** * {@inheritdoc} */ public function garbageCollection() { - // APC performs garbage collection automatically. + // APCu performs garbage collection automatically. } /** * {@inheritdoc} */ public function removeBin() { - apc_delete(new \APCIterator('user', '/^' . preg_quote($this->binPrefix, '/') . '/')); + apcu_delete($this->getIterator('/^' . preg_quote($this->binPrefix, '/') . '/')); } /** @@ -252,4 +252,25 @@ public function invalidateAll() { } } + /** + * Instantiates and returns the APCUIterator class. + * + * @param mixed $search + * A PCRE regular expression that matches against APC key names, either as a + * string for a single regular expression, or as an array of regular + * expressions. Or, optionally pass in NULL to skip the search. + * @param int $format + * The desired format, as configured with one or more of the APC_ITER_* + * constants. + * @param int $chunk_size + * The chunk size. Must be a value greater than 0. The default value is 100. + * @param int $list + * The type to list. Either pass in APC_LIST_ACTIVE or APC_LIST_DELETED. + * + * @return \APCUIterator + */ + protected function getIterator($search = NULL, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE) { + return new \APCUIterator($search, $format, $chunk_size, $list); + } + } diff --git a/d8/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php b/d8/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php index f744edc2..dae24dcf 100644 --- a/d8/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php +++ b/d8/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php @@ -25,6 +25,13 @@ class ApcuBackendFactory implements CacheFactoryInterface { */ protected $checksumProvider; + /** + * The APCU backend class to use. + * + * @var string + */ + protected $backendClass; + /** * Constructs an ApcuBackendFactory object. * @@ -38,6 +45,12 @@ class ApcuBackendFactory implements CacheFactoryInterface { public function __construct($root, $site_path, CacheTagsChecksumInterface $checksum_provider) { $this->sitePrefix = Settings::getApcuPrefix('apcu_backend', $root, $site_path); $this->checksumProvider = $checksum_provider; + if (version_compare(phpversion('apcu'), '5.0.0', '>=')) { + $this->backendClass = 'Drupal\Core\Cache\ApcuBackend'; + } + else { + $this->backendClass = 'Drupal\Core\Cache\Apcu4Backend'; + } } /** @@ -50,7 +63,7 @@ public function __construct($root, $site_path, CacheTagsChecksumInterface $check * The cache backend object for the specified cache bin. */ public function get($bin) { - return new ApcuBackend($bin, $this->sitePrefix, $this->checksumProvider); + return new $this->backendClass($bin, $this->sitePrefix, $this->checksumProvider); } } diff --git a/d8/core/lib/Drupal/Core/Cache/CacheFactory.php b/d8/core/lib/Drupal/Core/Cache/CacheFactory.php index a8a5c41e..a5acf7c8 100644 --- a/d8/core/lib/Drupal/Core/Cache/CacheFactory.php +++ b/d8/core/lib/Drupal/Core/Cache/CacheFactory.php @@ -14,7 +14,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareTrait; -class CacheFactory implements CacheFactoryInterface, ContainerAwareInterface { +class CacheFactory implements CacheFactoryInterface, ContainerAwareInterface { use ContainerAwareTrait; diff --git a/d8/core/lib/Drupal/Core/Cache/CacheableResponseInterface.php b/d8/core/lib/Drupal/Core/Cache/CacheableResponseInterface.php index 0bca8d1f..c43085e1 100644 --- a/d8/core/lib/Drupal/Core/Cache/CacheableResponseInterface.php +++ b/d8/core/lib/Drupal/Core/Cache/CacheableResponseInterface.php @@ -17,9 +17,9 @@ interface CacheableResponseInterface { /** * Adds a dependency on an object: merges its cacheability metadata. * - * E.g. when a response depends on some configuration, an entity, or an access - * result, we must make sure their cacheability metadata is present on the - * response. This method makes doing that simple. + * For instance, when a response depends on some configuration, an entity, or + * an access result, we must make sure their cacheability metadata is present + * on the response. This method makes doing that simple. * * @param \Drupal\Core\Cache\CacheableDependencyInterface|mixed $dependency * The dependency. If the object implements CacheableDependencyInterface, diff --git a/d8/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php b/d8/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php index bba9d940..ca38ca0b 100644 --- a/d8/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php +++ b/d8/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php @@ -53,7 +53,7 @@ public function __construct(Settings $settings = NULL, $consistent_service_name } // Default the fast backend to APCu if it's available. - if (!isset($fast_service_name) && function_exists('apc_fetch')) { + if (!isset($fast_service_name) && function_exists('apcu_fetch')) { $fast_service_name = 'cache.backend.apcu'; } diff --git a/d8/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php b/d8/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php index 81d67350..c8752716 100644 --- a/d8/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php +++ b/d8/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php @@ -92,9 +92,10 @@ public function getLabels($include_calculated_cache_contexts = FALSE) { * * A cache context token is either: * - a cache context ID (if the service ID is 'cache_context.foo', then 'foo' - * is a cache context ID), e.g. 'foo' - * - a calculated cache context ID, followed by a double colon, followed by - * the parameter for the calculated cache context, e.g. 'bar:some_parameter' + * is a cache context ID); for example, 'foo'. + * - a calculated cache context ID, followed by a colon, followed by + * the parameter for the calculated cache context; for example, + * 'bar:some_parameter'. * * @param string[] $context_tokens * An array of cache context tokens. @@ -142,11 +143,12 @@ public function convertTokensToKeys(array $context_tokens) { * If a cache context is being optimized away, it is able to set cacheable * metadata for itself which will be bubbled up. * - * E.g. when caching per user ('user'), also caching per role ('user.roles') - * is meaningless because "per role" is implied by "per user". + * For example, when caching per user ('user'), also caching per role + * ('user.roles') is meaningless because "per role" is implied by "per user". * - * Examples — remember that the period indicates hierarchy and the colon can - * be used to get a specific value of a calculated cache context: + * In the following examples, remember that the period indicates hierarchy and + * the colon can be used to get a specific value of a calculated cache + * context: * - ['a', 'a.b'] -> ['a'] * - ['a', 'a.b.c'] -> ['a'] * - ['a.b', 'a.b.c'] -> ['a.b'] diff --git a/d8/core/lib/Drupal/Core/Condition/ConditionManager.php b/d8/core/lib/Drupal/Core/Condition/ConditionManager.php index 96cc00e0..a351c702 100644 --- a/d8/core/lib/Drupal/Core/Condition/ConditionManager.php +++ b/d8/core/lib/Drupal/Core/Condition/ConditionManager.php @@ -49,7 +49,7 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac } /** - * Override of Drupal\Component\Plugin\PluginManagerBase::createInstance(). + * {@inheritdoc} */ public function createInstance($plugin_id, array $configuration = array()) { $plugin = $this->getFactory()->createInstance($plugin_id, $configuration); diff --git a/d8/core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php b/d8/core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php index 2dc6caaa..136238cf 100644 --- a/d8/core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php +++ b/d8/core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php @@ -18,7 +18,7 @@ abstract class ConfigFactoryOverrideBase implements EventSubscriberInterface { * Reacts to the ConfigEvents::COLLECTION_INFO event. * * @param \Drupal\Core\Config\ConfigCollectionInfo $collection_info - * The configuration collection names event. + * The configuration collection info event. */ abstract public function addCollections(ConfigCollectionInfo $collection_info); diff --git a/d8/core/lib/Drupal/Core/Config/ConfigInstaller.php b/d8/core/lib/Drupal/Core/Config/ConfigInstaller.php index ae12c918..a77bb1c2 100644 --- a/d8/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/d8/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Config; +use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\Unicode; use Drupal\Core\Config\Entity\ConfigDependencyManager; use Drupal\Core\Config\Entity\ConfigEntityDependency; @@ -279,6 +280,12 @@ protected function createConfiguration($collection, array $config_to_create) { } if ($config_to_create[$name] !== FALSE) { $new_config->setData($config_to_create[$name]); + // Add a hash to configuration created through the installer so it is + // possible to know if the configuration was created by installing an + // extension and to track which version of the default config was used. + if (!$this->isSyncing() && $collection == StorageInterface::DEFAULT_COLLECTION) { + $new_config->set('_core.default_config_hash', Crypt::hashBase64(serialize($config_to_create[$name]))); + } } if ($collection == StorageInterface::DEFAULT_COLLECTION && $entity_type = $this->configManager->getEntityTypeIdByName($name)) { // If we are syncing do not create configuration entities. Pluggable diff --git a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index bb396e6d..6627b3d2 100644 --- a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -39,16 +39,6 @@ abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface */ protected $originalId; - /** - * The name of the property that is used to store plugin configuration. - * - * This is needed when the entity uses a LazyPluginCollection, to dictate - * where the plugin configuration should be stored. - * - * @var string - */ - protected $pluginConfigKey; - /** * The enabled/disabled status of the configuration entity. * @@ -103,6 +93,17 @@ abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface */ protected $third_party_settings = array(); + /** + * Information maintained by Drupal core about configuration. + * + * Keys: + * - default_config_hash: A hash calculated by the config.installer service + * and added during installation. + * + * @var array + */ + protected $_core = []; + /** * Trust supplied data and not use configuration schema on save. * @@ -296,6 +297,9 @@ public function toArray() { if (empty($this->third_party_settings)) { unset($properties['third_party_settings']); } + if (empty($this->_core)) { + unset($properties['_core']); + } return $properties; } diff --git a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php index 8e27aef7..47a8f308 100644 --- a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php +++ b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php @@ -54,6 +54,7 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) { } // Entity bundle field definitions may depend on bundle settings. $entity_manager->clearCachedFieldDefinitions(); + $entity_manager->clearCachedBundles(); } } diff --git a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php index 766fa6ff..42c9ab5c 100644 --- a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php +++ b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php @@ -169,9 +169,6 @@ public function calculateDependencies(); * Dependency types are, for example, entity, module and theme. * * @return bool - * TRUE if the entity has changed, FALSE if not. - * - * @return bool * TRUE if the entity has been changed as a result, FALSE if not. * * @see \Drupal\Core\Config\Entity\ConfigDependencyManager diff --git a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php index 55c11932..10b8142b 100644 --- a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php +++ b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php @@ -18,10 +18,10 @@ interface ConfigEntityStorageInterface extends EntityStorageInterface { * Extracts the configuration entity ID from the full configuration name. * * @param string $config_name - * The full configuration name to extract the ID from. E.g. + * The full configuration name to extract the ID from; for example, * 'views.view.archive'. * @param string $config_prefix - * The config prefix of the configuration entity. E.g. 'views.view' + * The config prefix of the configuration entity; for example, 'views.view'. * * @return string * The ID of the configuration entity. diff --git a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php index 527a336f..785b3145 100644 --- a/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php +++ b/d8/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php @@ -157,6 +157,7 @@ public function getPropertiesToExport() { 'status' => 'status', 'dependencies' => 'dependencies', 'third_party_settings' => 'third_party_settings', + '_core' => '_core', ]; foreach ($this->config_export as $property => $name) { if (is_numeric($property)) { diff --git a/d8/core/lib/Drupal/Core/Config/FileStorage.php b/d8/core/lib/Drupal/Core/Config/FileStorage.php index c630fec2..03b0464b 100644 --- a/d8/core/lib/Drupal/Core/Config/FileStorage.php +++ b/d8/core/lib/Drupal/Core/Config/FileStorage.php @@ -95,12 +95,13 @@ public function read($name) { if (!$this->exists($name)) { return FALSE; } - $data = file_get_contents($this->getFilePath($name)); + $filepath = $this->getFilePath($name); + $data = file_get_contents($filepath); try { $data = $this->decode($data); } catch (InvalidDataTypeException $e) { - throw new UnsupportedDataTypeConfigException("Invalid data type in config $name: {$e->getMessage()}"); + throw new UnsupportedDataTypeConfigException('Invalid data type in config ' . $name . ', found in file' . $filepath . ' : ' . $e->getMessage()); } return $data; } diff --git a/d8/core/lib/Drupal/Core/Config/InstallStorage.php b/d8/core/lib/Drupal/Core/Config/InstallStorage.php index a1d967d0..ca96bd77 100644 --- a/d8/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/d8/core/lib/Drupal/Core/Config/InstallStorage.php @@ -80,9 +80,9 @@ public function __construct($directory = self::CONFIG_INSTALL_DIRECTORY, $collec * The path to the configuration file. * * @todo Improve this when figuring out how we want to handle configuration in - * installation profiles. E.g., a config object actually has to be searched - * in the profile first (whereas the profile is never the owner), only - * afterwards check for a corresponding module or theme. + * installation profiles. For instance, a config object actually has to be + * searched in the profile first (whereas the profile is never the owner); + * only afterwards check for a corresponding module or theme. */ public function getFilePath($name) { $folders = $this->getAllFolders(); diff --git a/d8/core/lib/Drupal/Core/Config/TypedConfigManager.php b/d8/core/lib/Drupal/Core/Config/TypedConfigManager.php index ca0eb507..b2c94ed3 100644 --- a/d8/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/d8/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -86,6 +86,7 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa // Add default values for data type and replace variables. $definition += array('type' => 'undefined'); + $replace = []; $type = $definition['type']; if (strpos($type, ']')) { // Replace variable names in definition. @@ -102,7 +103,7 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa unset($definition['type']); } // Add default values from type definition. - $definition += $this->getDefinition($type); + $definition += $this->_getDefinitionWithReplacements($type, $replace); $data_definition = $this->createDataDefinition($definition['type']); @@ -116,10 +117,17 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa } /** - * {@inheritdoc} + * Determines the typed config type for a plugin ID. + * + * @param string $base_plugin_id + * The plugin ID. + * @param array $definitions + * An array of typed config definitions. + * + * @return string + * The typed config type for the given plugin ID. */ - public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { - $definitions = $this->getDefinitions(); + protected function _determineType($base_plugin_id, array $definitions) { if (isset($definitions[$base_plugin_id])) { $type = $base_plugin_id; } @@ -131,6 +139,27 @@ public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { // If we don't have definition, return the 'undefined' element. $type = 'undefined'; } + return $type; + } + + /** + * Gets a schema definition with replacements for dynamic names. + * + * @param string $base_plugin_id + * A plugin ID. + * @param array $replacements + * An array of replacements for dynamic type names. + * @param bool $exception_on_invalid + * (optional) This parameter is passed along to self::getDefinition(). + * However, self::getDefinition() does not respect this parameter, so it is + * effectively useless in this context. + * + * @return array + * A schema definition array. + */ + protected function _getDefinitionWithReplacements($base_plugin_id, array $replacements, $exception_on_invalid = TRUE) { + $definitions = $this->getDefinitions(); + $type = $this->_determineType($base_plugin_id, $definitions); $definition = $definitions[$type]; // Check whether this type is an extension of another one and compile it. if (isset($definition['type'])) { @@ -138,6 +167,15 @@ public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { // Preserve integer keys on merge, so sequence item types can override // parent settings as opposed to adding unused second, third, etc. items. $definition = NestedArray::mergeDeepArray(array($merge, $definition), TRUE); + + // Replace dynamic portions of the definition type. + if (!empty($replacements) && strpos($definition['type'], ']')) { + $sub_type = $this->_determineType($this->replaceName($definition['type'], $replacements), $definitions); + // Merge the newly determined subtype definition with the original + // definition. + $definition = NestedArray::mergeDeepArray([$definitions[$sub_type], $definition], TRUE); + } + // Unset type so we try the merge only once per type. unset($definition['type']); $this->definitions[$type] = $definition; @@ -150,6 +188,13 @@ public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { return $definition; } + /** + * {@inheritdoc} + */ + public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { + return $this->_getDefinitionWithReplacements($base_plugin_id, [], $exception_on_invalid); + } + /** * {@inheritdoc} */ diff --git a/d8/core/lib/Drupal/Core/CoreServiceProvider.php b/d8/core/lib/Drupal/Core/CoreServiceProvider.php index 101c3bcf..82e8bd57 100644 --- a/d8/core/lib/Drupal/Core/CoreServiceProvider.php +++ b/d8/core/lib/Drupal/Core/CoreServiceProvider.php @@ -105,8 +105,8 @@ public function register(ContainerBuilder $container) { /** * Determines and registers the UUID service. * - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container - * The container. + * @param \Drupal\Core\DependencyInjection\ContainerBuilder $container + * The container builder. * * @return string * Class name for the UUID service. @@ -131,6 +131,9 @@ public static function registerUuid(ContainerBuilder $container) { /** * Registers services and event subscribers for a site under test. + * + * @param \Drupal\Core\DependencyInjection\ContainerBuilder $container + * The container builder. */ protected function registerTest(ContainerBuilder $container) { // Do nothing if we are not in a test environment. diff --git a/d8/core/lib/Drupal/Core/Database/Connection.php b/d8/core/lib/Drupal/Core/Database/Connection.php index 03335773..2aa63151 100644 --- a/d8/core/lib/Drupal/Core/Database/Connection.php +++ b/d8/core/lib/Drupal/Core/Database/Connection.php @@ -90,7 +90,7 @@ abstract class Connection { /** * An index used to generate unique temporary table names. * - * @var integer + * @var int */ protected $temporaryNameIndex = 0; diff --git a/d8/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/d8/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php index c59e2e43..d12788f1 100644 --- a/d8/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php +++ b/d8/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php @@ -39,7 +39,7 @@ class Schema extends DatabaseSchema { * Value will usually be set to a 63 chars limit but PostgreSQL allows * to higher this value before compiling, so we need to check for that. * - * @var integer + * @var int */ protected $maxIdentifierLength; diff --git a/d8/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php b/d8/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php index 95cdf53d..2a811e6d 100644 --- a/d8/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php +++ b/d8/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php @@ -64,10 +64,9 @@ public function __construct(SelectInterface $query, Connection $connection) { * to it. */ public function execute() { - - // Add convenience tag to mark that this is an extended query. We have to - // do this in the constructor to ensure that it is set before preExecute() - // gets called. + // By calling preExecute() here, we force it to preprocess the extender + // object rather than just the base query object. That means + // hook_query_alter() gets access to the extended object. if (!$this->preExecute($this)) { return NULL; } diff --git a/d8/core/lib/Drupal/Core/DrupalKernel.php b/d8/core/lib/Drupal/Core/DrupalKernel.php index 278826e0..d6c6f450 100644 --- a/d8/core/lib/Drupal/Core/DrupalKernel.php +++ b/d8/core/lib/Drupal/Core/DrupalKernel.php @@ -428,7 +428,7 @@ public function boot() { ]; // @todo Use extension_loaded('apcu') for non-testbot // https://www.drupal.org/node/2447753. - if (function_exists('apc_fetch')) { + if (function_exists('apcu_fetch')) { $configuration['default']['cache_backend_class'] = '\Drupal\Component\FileCache\ApcuFileCacheBackend'; } } @@ -970,9 +970,11 @@ protected function initializeSettings(Request $request) { // If the class loader is still the same, possibly upgrade to the APC class // loader. + // ApcClassLoader does not support APCu without backwards compatibility + // enabled. if ($class_loader_class == get_class($this->classLoader) && Settings::get('class_loader_auto_detect', TRUE) - && function_exists('apc_fetch')) { + && extension_loaded('apc')) { $prefix = Settings::getApcuPrefix('class_loader', $this->root); $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader); $this->classLoader->unregister(); @@ -1307,7 +1309,7 @@ protected function getModulesParameter() { * * @return array * Array where each key is a module name, and each value is a path to the - * respective *.module or *.profile file. + * respective *.info.yml file. */ protected function getModuleFileNames() { $filenames = array(); @@ -1324,7 +1326,7 @@ protected function getModuleFileNames() { * * @param string[] $module_file_names * Array where each key is a module name, and each value is a path to the - * respective *.module or *.profile file. + * respective *.info.yml file. * * @return string[] * Array where each key is a module namespace like 'Drupal\system', and each diff --git a/d8/core/lib/Drupal/Core/Entity/Annotation/ConfigEntityType.php b/d8/core/lib/Drupal/Core/Entity/Annotation/ConfigEntityType.php index 4c7524bc..658b426c 100644 --- a/d8/core/lib/Drupal/Core/Entity/Annotation/ConfigEntityType.php +++ b/d8/core/lib/Drupal/Core/Entity/Annotation/ConfigEntityType.php @@ -6,15 +6,14 @@ */ namespace Drupal\Core\Entity\Annotation; + use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Defines a config entity type annotation object. * - * Config Entity type plugins use an object-based annotation method, rather than an - * array-type annotation method (as commonly used on other annotation types). * The annotation properties of entity types are found on - * \Drupal\Core\Entity\ConfigEntityType and are accessed using + * \Drupal\Core\Config\Entity\ConfigEntityType and are accessed using * get/set methods defined in \Drupal\Core\Entity\EntityTypeInterface. * * @ingroup entity_api diff --git a/d8/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/d8/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index 5eb5c30b..3e58501a 100644 --- a/d8/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/d8/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -440,7 +440,8 @@ protected function invokeHook($hook, EntityInterface $entity) { protected function invokeFieldMethod($method, ContentEntityInterface $entity) { $result = []; $args = array_slice(func_get_args(), 2); - foreach (array_keys($entity->getTranslationLanguages()) as $langcode) { + $langcodes = array_keys($entity->getTranslationLanguages()); + foreach ($langcodes as $langcode) { $translation = $entity->getTranslation($langcode); // For non translatable fields, there is only one field object instance // across all translations and it has as parent entity the entity in the @@ -453,6 +454,20 @@ protected function invokeFieldMethod($method, ContentEntityInterface $entity) { $result[$langcode][$name] = $args ? call_user_func_array([$items, $method], $args) : $items->{$method}(); } } + + // We need to call the delete method for field items of removed + // translations. + if ($method == 'postSave' && !empty($entity->original)) { + $original_langcodes = array_keys($entity->original->getTranslationLanguages()); + foreach (array_diff($original_langcodes, $langcodes) as $removed_langcode) { + $translation = $entity->original->getTranslation($removed_langcode); + $fields = $translation->getTranslatableFields(); + foreach ($fields as $name => $items) { + $items->delete(); + } + } + } + return $result; } diff --git a/d8/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/d8/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php index 6dd6e10c..d94e2b5f 100644 --- a/d8/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php +++ b/d8/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php @@ -10,6 +10,7 @@ use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\Tags; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface; use Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element\Textfield; @@ -146,6 +147,7 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte 'handler' => $element['#selection_handler'], 'handler_settings' => $element['#selection_settings'], ); + /** @var /Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface $handler */ $handler = \Drupal::service('plugin.manager.entity_reference_selection')->getInstance($options); $autocreate = (bool) $element['#autocreate'] && $handler instanceof SelectionWithAutocreateInterface; @@ -164,6 +166,7 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte ); } elseif ($autocreate) { + /** @var \Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface $handler */ // Auto-create item. See an example of how this is handled in // \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::presave(). $value[] = array( @@ -211,6 +214,7 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte } foreach ($invalid_new_entities as $entity) { + /** @var \Drupal\Core\Entity\EntityInterface $entity */ $form_state->setError($element, t('This entity (%type: %label) cannot be referenced.', array('%type' => $element['#target_type'], '%label' => $entity->label()))); } } @@ -233,6 +237,8 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte * The method will return an entity ID if one single entity unambuguously * matches the incoming input, and sill assign form errors otherwise. * + * @param \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface $handler + * Entity reference selection plugin. * @param string $input * Single string from autocomplete element. * @param array $element @@ -243,10 +249,10 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte * Whether to trigger a form error if an element from $input (eg. an entity) * is not found. * - * @return integer|null + * @return int|null * Value of a matching entity ID, or NULL if none. */ - protected static function matchEntityByTitle($handler, $input, &$element, FormStateInterface $form_state, $strict) { + protected static function matchEntityByTitle(SelectionInterface $handler, $input, array &$element, FormStateInterface $form_state, $strict) { $entities_by_bundle = $handler->getReferenceableEntities($input, '=', 6); $entities = array_reduce($entities_by_bundle, function ($flattened, $bundle_entities) { return $flattened + $bundle_entities; @@ -324,11 +330,11 @@ public static function extractEntityIdFromAutocompleteInput($input) { // Take "label (entity id)', match the ID from parenthesis when it's a // number. - if (preg_match("/.+\((\d+)\)/", $input, $matches)) { + if (preg_match("/.+\s\((\d+)\)/", $input, $matches)) { $match = $matches[1]; } // Match the ID when it's a string (e.g. for config entity types). - elseif (preg_match("/.+\(([\w.]+)\)/", $input, $matches)) { + elseif (preg_match("/.+\s\(([\w.]+)\)/", $input, $matches)) { $match = $matches[1]; } diff --git a/d8/core/lib/Drupal/Core/Entity/Entity.php b/d8/core/lib/Drupal/Core/Entity/Entity.php index 8164d7c1..b49f3d48 100644 --- a/d8/core/lib/Drupal/Core/Entity/Entity.php +++ b/d8/core/lib/Drupal/Core/Entity/Entity.php @@ -320,11 +320,6 @@ protected function urlRouteParameters($rel) { /** * {@inheritdoc} - * - * Returns a list of URI relationships supported by this entity. - * - * @return array - * An array of link relationships supported by this entity. */ public function uriRelationships() { return array_keys($this->linkTemplates()); @@ -497,9 +492,6 @@ public function getCacheMaxAge() { /** * {@inheritdoc} - * - * @return static|null - * The entity object or NULL if there is no entity with the given ID. */ public static function load($id) { $entity_manager = \Drupal::entityManager(); @@ -508,10 +500,6 @@ public static function load($id) { /** * {@inheritdoc} - * - * @return static[] - * An array of entity objects indexed by their IDs. Returns an empty array - * if no matching entities are found. */ public static function loadMultiple(array $ids = NULL) { $entity_manager = \Drupal::entityManager(); @@ -520,9 +508,6 @@ public static function loadMultiple(array $ids = NULL) { /** * {@inheritdoc} - * - * @return static - * The entity object. */ public static function create(array $values = array()) { $entity_manager = \Drupal::entityManager(); diff --git a/d8/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php b/d8/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php index 6d8d7fb3..27fda29e 100644 --- a/d8/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php +++ b/d8/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php @@ -206,6 +206,7 @@ public function resetCache() { public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = array(), $return_as_object = FALSE) { $account = $this->prepareUser($account); $context += array( + 'entity_type_id' => $this->entityTypeId, 'langcode' => LanguageInterface::LANGCODE_DEFAULT, ); diff --git a/d8/core/lib/Drupal/Core/Entity/EntityInterface.php b/d8/core/lib/Drupal/Core/Entity/EntityInterface.php index 62a8f447..89b99ac9 100644 --- a/d8/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/d8/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -113,7 +113,7 @@ public function label(); * The URL object. * * @deprecated in Drupal 8.0.0, intended to be removed in Drupal 9.0.0 - * Use toUrl() instead. + * Use \Drupal\Core\Entity\EntityInterface::toUrl() instead. * * @see \Drupal\Core\Entity\EntityInterface::toUrl */ diff --git a/d8/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php b/d8/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php index 00590a54..365fa563 100644 --- a/d8/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php +++ b/d8/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php @@ -41,7 +41,7 @@ class EntityReference extends DataReferenceBase { /** * The entity ID. * - * @var integer|string + * @var int|string */ protected $id; diff --git a/d8/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php b/d8/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php index 63f8c69a..b108bb45 100644 --- a/d8/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php +++ b/d8/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php @@ -257,7 +257,7 @@ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTA $entities = $this->entityManager->getStorage($target_type)->loadMultiple($result); foreach ($entities as $entity_id => $entity) { $bundle = $entity->bundle(); - $options[$bundle][$entity_id] = Html::escape($entity->label()); + $options[$bundle][$entity_id] = Html::escape($this->entityManager->getTranslationFromContext($entity)->label()); } return $options; diff --git a/d8/core/lib/Drupal/Core/Entity/entity.api.php b/d8/core/lib/Drupal/Core/Entity/entity.api.php index 686271d5..d33b422b 100644 --- a/d8/core/lib/Drupal/Core/Entity/entity.api.php +++ b/d8/core/lib/Drupal/Core/Entity/entity.api.php @@ -592,7 +592,8 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o * The account trying to access the entity. * @param array $context * An associative array of additional context values. By default it contains - * language: + * language and the entity type ID: + * - entity_type_id - the entity type ID. * - langcode - the current language code. * @param string $entity_bundle * The entity bundle name. @@ -1964,7 +1965,7 @@ function hook_ENTITY_TYPE_field_values_init(\Drupal\Core\Entity\FieldableEntityI * * @return array * The array structure is identical to that of the return value of - * \Drupal\Core\Entity\EntityManagerInterface::getExtraFields(). + * \Drupal\Core\Entity\EntityFieldManagerInterface::getExtraFields(). */ function hook_entity_extra_field_info() { $extra = array(); diff --git a/d8/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php b/d8/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php index 6fd0b999..da0ff664 100644 --- a/d8/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php +++ b/d8/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php @@ -83,8 +83,11 @@ public function onKernelRequestAuthenticate(GetResponseEvent $event) { $account = $this->authenticationProvider->authenticate($request); if ($account) { $this->accountProxy->setAccount($account); + return; } } + // No account has been set explicitly, initialize the timezone here. + date_default_timezone_set(drupal_get_user_timezone()); } } diff --git a/d8/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php b/d8/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php index 2ae21143..46336e0a 100644 --- a/d8/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php +++ b/d8/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php @@ -70,7 +70,7 @@ protected static function getPriority() { } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function getHandledFormats() { return ['html']; diff --git a/d8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php b/d8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php index da6327d5..0daf1767 100644 --- a/d8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php +++ b/d8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php @@ -160,8 +160,8 @@ protected function wrapControllerExecutionInRenderContext($controller, array $ar } else { // A Response or domain object is returned that does not care about - // attachments nor cacheability. E.g. a RedirectResponse. It is safe to - // discard any early rendering metadata. + // attachments nor cacheability; for instance, a RedirectResponse. It is + // safe to discard any early rendering metadata. } } diff --git a/d8/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php b/d8/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php index 0aefe961..c06adee4 100644 --- a/d8/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php +++ b/d8/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php @@ -17,7 +17,7 @@ class ExceptionJsonSubscriber extends HttpExceptionSubscriberBase { /** - * {@inheritDoc} + * {@inheritdoc} */ protected function getHandledFormats() { return ['json']; diff --git a/d8/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php b/d8/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php index 17c87a34..73b5ac05 100644 --- a/d8/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php +++ b/d8/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php @@ -23,7 +23,7 @@ protected static function getPriority() { } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function getHandledFormats() { return ['html']; diff --git a/d8/core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php b/d8/core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php index 3f095b0f..d3ae5d34 100644 --- a/d8/core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php +++ b/d8/core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php @@ -59,7 +59,7 @@ protected static function getPriority() { } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function getHandledFormats() { return ['html']; diff --git a/d8/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/d8/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php index c088eedb..3d68561b 100644 --- a/d8/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php +++ b/d8/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php @@ -15,6 +15,13 @@ /** * Discovers available extensions in the filesystem. + * + * To also discover test modules, add + * @code + * $settings['extension_discovery_scan_tests'] = TRUE; + * @encode + * to your settings.php. + * */ class ExtensionDiscovery { @@ -134,6 +141,12 @@ public function __construct($root, $use_file_cache = TRUE, $profile_directories * - the site-wide directory; i.e., / * - the site-specific directory; e.g., /sites/example.com * + * To also find test modules, add + * @code + * $settings['extension_discovery_scan_tests'] = TRUE; + * @encode + * to your settings.php. + * * The information is returned in an associative array, keyed by the extension * name (without .info.yml extension). Extensions found later in the search * will take precedence over extensions found earlier - unless they are not diff --git a/d8/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php b/d8/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php index d614fdbc..3d61d2e6 100644 --- a/d8/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php +++ b/d8/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php @@ -237,7 +237,9 @@ public function invoke($module, $hook, array $args = array()); * * @return array * An array of return values of the hook implementations. If modules return - * arrays from their implementations, those are merged into one array. + * arrays from their implementations, those are merged into one array + * recursively. Note: integer keys in arrays will be lost, as the merge is + * done using array_merge_recursive(). */ public function invokeAll($hook, array $args = array()); diff --git a/d8/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php b/d8/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php index bd2923a6..048b9e63 100644 --- a/d8/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php +++ b/d8/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php @@ -23,6 +23,12 @@ interface ModuleInstallerInterface { * - Invoke hook_install() and add it to the list of installed modules. * - Invoke hook_modules_installed(). * + * To install test modules add + * @code + * $settings['extension_discovery_scan_tests'] = TRUE; + * @encode + * to your settings.php. + * * @param string[] $module_list * An array of module names. * @param bool $enable_dependencies diff --git a/d8/core/lib/Drupal/Core/Extension/ThemeHandler.php b/d8/core/lib/Drupal/Core/Extension/ThemeHandler.php index c3d86842..59cfd993 100644 --- a/d8/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/d8/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -19,9 +19,12 @@ class ThemeHandler implements ThemeHandlerInterface { * Contains the features enabled for themes by default. * * @var array + * + * @see _system_default_theme_features() */ protected $defaultFeatures = array( 'favicon', + 'logo', 'node_user_picture', 'comment_user_picture', 'comment_user_verification', diff --git a/d8/core/lib/Drupal/Core/Field/FieldFilteredMarkup.php b/d8/core/lib/Drupal/Core/Field/FieldFilteredMarkup.php index 8dcadca6..d2c69e06 100644 --- a/d8/core/lib/Drupal/Core/Field/FieldFilteredMarkup.php +++ b/d8/core/lib/Drupal/Core/Field/FieldFilteredMarkup.php @@ -61,7 +61,7 @@ public static function create($string) { * A list of allowed tags. */ public static function allowedTags() { - return ['a', 'b', 'big', 'code', 'del', 'em', 'i', 'ins', 'pre', 'q', 'small', 'span', 'strong', 'sub', 'sup', 'tt', 'ol', 'ul', 'li', 'p', 'br', 'img']; + return ['a', 'b', 'big', 'code', 'del', 'em', 'i', 'ins', 'pre', 'q', 'small', 'span', 'strong', 'sub', 'sup', 'tt', 'ol', 'ul', 'li', 'p', 'br', 'img']; } /** diff --git a/d8/core/lib/Drupal/Core/Field/FieldItemBase.php b/d8/core/lib/Drupal/Core/Field/FieldItemBase.php index c73c7fd0..033b82e6 100644 --- a/d8/core/lib/Drupal/Core/Field/FieldItemBase.php +++ b/d8/core/lib/Drupal/Core/Field/FieldItemBase.php @@ -70,7 +70,7 @@ public function getEntity() { * {@inheritdoc} */ public function getLangcode() { - return $this->parent->getLangcode(); + return $this->getParent()->getLangcode(); } /** diff --git a/d8/core/lib/Drupal/Core/Field/FieldItemList.php b/d8/core/lib/Drupal/Core/Field/FieldItemList.php index 2121334a..c64a6072 100644 --- a/d8/core/lib/Drupal/Core/Field/FieldItemList.php +++ b/d8/core/lib/Drupal/Core/Field/FieldItemList.php @@ -115,7 +115,7 @@ public function getValue($include_computed = FALSE) { * {@inheritdoc} */ public function setValue($values, $notify = TRUE) { - // Support passing in only the value of the first item, either as a litteral + // Support passing in only the value of the first item, either as a literal // (value of the first property) or as an array of properties. if (isset($values) && (!is_array($values) || (!empty($values) && !is_numeric(current(array_keys($values)))))) { $values = array(0 => $values); diff --git a/d8/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/d8/core/lib/Drupal/Core/Field/FieldItemListInterface.php index df595e52..8671c5bd 100644 --- a/d8/core/lib/Drupal/Core/Field/FieldItemListInterface.php +++ b/d8/core/lib/Drupal/Core/Field/FieldItemListInterface.php @@ -102,28 +102,28 @@ public function filterEmptyItems(); /** * Magic method: Gets a property value of to the first field item. * - * @see \Drupal\Core\Field\FieldItemInterface::__get() + * @see \Drupal\Core\Field\FieldItemInterface::__set() */ public function __get($property_name); /** * Magic method: Sets a property value of the first field item. * - * @see \Drupal\Core\Field\FieldItemInterface::__set() + * @see \Drupal\Core\Field\FieldItemInterface::__get() */ public function __set($property_name, $value); /** * Magic method: Determines whether a property of the first field item is set. * - * @see \Drupal\Core\Field\FieldItemInterface::__isset() + * @see \Drupal\Core\Field\FieldItemInterface::__unset() */ public function __isset($property_name); /** * Magic method: Unsets a property of the first field item. * - * @see \Drupal\Core\Field\FieldItemInterface::__unset() + * @see \Drupal\Core\Field\FieldItemInterface::__isset() */ public function __unset($property_name); diff --git a/d8/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/d8/core/lib/Drupal/Core/Field/FieldTypePluginManager.php index 3d896b27..f99948a8 100644 --- a/d8/core/lib/Drupal/Core/Field/FieldTypePluginManager.php +++ b/d8/core/lib/Drupal/Core/Field/FieldTypePluginManager.php @@ -156,7 +156,7 @@ public function getUiDefinitions() { } /** - * @inheritdoc + * {@inheritdoc} */ public function getPluginClass($type) { $plugin_definition = $this->getDefinition($type, FALSE); diff --git a/d8/core/lib/Drupal/Core/Field/FormatterPluginManager.php b/d8/core/lib/Drupal/Core/Field/FormatterPluginManager.php index e6054a9a..1d6b27e4 100644 --- a/d8/core/lib/Drupal/Core/Field/FormatterPluginManager.php +++ b/d8/core/lib/Drupal/Core/Field/FormatterPluginManager.php @@ -136,7 +136,7 @@ public function getInstance(array $options) { * * @param string $field_type * The field type. - * @param array $properties + * @param array $configuration * An array of formatter configuration. * * @return array diff --git a/d8/core/lib/Drupal/Core/Field/Plugin/DataType/Deriver/FieldItemDeriver.php b/d8/core/lib/Drupal/Core/Field/Plugin/DataType/Deriver/FieldItemDeriver.php index c4cfeb18..e675286f 100644 --- a/d8/core/lib/Drupal/Core/Field/Plugin/DataType/Deriver/FieldItemDeriver.php +++ b/d8/core/lib/Drupal/Core/Field/Plugin/DataType/Deriver/FieldItemDeriver.php @@ -42,7 +42,7 @@ class FieldItemDeriver implements ContainerDeriverInterface { * * @param string $base_plugin_id * The base plugin ID. - * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager + * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_plugin_manager * The field type plugin manager. */ public function __construct($base_plugin_id, FieldTypePluginManagerInterface $field_type_plugin_manager) { diff --git a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php index 28229051..74c7523f 100644 --- a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php +++ b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php @@ -83,6 +83,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { } } + $field_name = $this->fieldDefinition->getName(); $form['format'] = [ '#type' => 'select', '#title' => $this->t('Output format'), @@ -95,7 +96,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { '#default_value' => $this->getSetting('format_custom_true'), '#states' => [ 'visible' => [ - 'select[name="fields[field_boolean][settings_edit_form][settings][format]"]' => ['value' => 'custom'], + 'select[name="fields[' . $field_name . '][settings_edit_form][settings][format]"]' => ['value' => 'custom'], ], ], ]; @@ -105,7 +106,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { '#default_value' => $this->getSetting('format_custom_false'), '#states' => [ 'visible' => [ - 'select[name="fields[field_boolean][settings_edit_form][settings][format]"]' => ['value' => 'custom'], + 'select[name="fields[' . $field_name . '][settings_edit_form][settings][format]"]' => ['value' => 'custom'], ], ], ]; diff --git a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php index 0e43ac11..a53e0b9f 100644 --- a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php +++ b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php @@ -55,7 +55,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { $range = range(0, 10); $elements['scale'] = array( '#type' => 'select', - '#title' => t('Scale', array(), array('decimal places')), + '#title' => t('Scale', array(), array('context' => 'decimal places')), '#options' => array_combine($range, $range), '#default_value' => $this->getSetting('scale'), '#description' => t('The number of digits to the right of the decimal.'), diff --git a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php index 8a4a6027..c2f23cf1 100644 --- a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php +++ b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php @@ -52,8 +52,6 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem * The view mode. * @param array $third_party_settings * Any third party settings settings. - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. * @param LoggerChannelFactoryInterface $logger_factory * The logger factory. */ diff --git a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php index e7030844..afa7586f 100644 --- a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php +++ b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php @@ -131,7 +131,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { ); $elements['custom_date_format']['#states']['visible'][] = array( - ':input[name="options[settings][date_format]"]' => array('value' => 'custom'), + ':input[name="name="fields[' . $this->fieldDefinition->getName() . '][settings_edit_form][settings][date_format]"]' => array('value' => 'custom'), ); $elements['timezone'] = array( diff --git a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php index e3867d4b..1f40b298 100644 --- a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php +++ b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php @@ -81,7 +81,7 @@ public function storageSettingsForm(array &$form, FormStateInterface $form_state $range = range(0, 10); $element['scale'] = array( '#type' => 'select', - '#title' => t('Scale', array(), array('decimal places')), + '#title' => t('Scale', array(), array('context' => 'decimal places')), '#options' => array_combine($range, $range), '#default_value' => $settings['scale'], '#description' => t('The number of digits to the right of the decimal.'), diff --git a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php index 7caa26fa..581adf24 100644 --- a/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php +++ b/d8/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php @@ -62,6 +62,9 @@ public function preSave() { $this->value = $entity->original->{$this->getFieldDefinition()->getName()}->value; } } + // Ensure that the existing password is unset to minimise risks of it + // getting serialized and stored somewhere. + $this->existing = NULL; } /** diff --git a/d8/core/lib/Drupal/Core/Field/WidgetBaseInterface.php b/d8/core/lib/Drupal/Core/Field/WidgetBaseInterface.php index 541f7c5e..18683c6f 100644 --- a/d8/core/lib/Drupal/Core/Field/WidgetBaseInterface.php +++ b/d8/core/lib/Drupal/Core/Field/WidgetBaseInterface.php @@ -75,7 +75,7 @@ public function flagErrors(FieldItemListInterface $items, ConstraintViolationLis /** * Retrieves processing information about the widget from $form_state. * - * This method is static so that is can be used in static Form API callbacks. + * This method is static so that it can be used in static Form API callbacks. * * @param array $parents * The array of #parents where the field lives in the form. @@ -95,7 +95,7 @@ public static function getWidgetState(array $parents, $field_name, FormStateInte /** * Stores processing information about the widget in $form_state. * - * This method is static so that is can be used in static Form API #callbacks. + * This method is static so that it can be used in static Form API #callbacks. * * @param array $parents * The array of #parents where the widget lives in the form. diff --git a/d8/core/lib/Drupal/Core/FileTransfer/FTPExtension.php b/d8/core/lib/Drupal/Core/FileTransfer/FTPExtension.php index 14bd16b8..cd605bcd 100644 --- a/d8/core/lib/Drupal/Core/FileTransfer/FTPExtension.php +++ b/d8/core/lib/Drupal/Core/FileTransfer/FTPExtension.php @@ -30,7 +30,7 @@ public function connect() { * {@inheritdoc} */ protected function copyFileJailed($source, $destination) { - if (!@ftp_put($this->connection, $destination, $source, FTP_BINARY)) { + if (!@ftp_put($this->connection, $destination, $source, FTP_BINARY)) { throw new FileTransferException("Cannot move @source to @destination", NULL, array("@source" => $source, "@destination" => $destination)); } } diff --git a/d8/core/lib/Drupal/Core/Form/FormState.php b/d8/core/lib/Drupal/Core/Form/FormState.php index bd47f1e4..a71e342b 100644 --- a/d8/core/lib/Drupal/Core/Form/FormState.php +++ b/d8/core/lib/Drupal/Core/Form/FormState.php @@ -212,9 +212,8 @@ class FormState implements FormStateInterface { * * The validation functions and submit functions use this array for nearly all * their decision making. (Note that #tree determines whether the values are a - * flat array or an array whose structure parallels the $form array. See the - * @link forms_api_reference.html Form API reference @endlink for more - * information.) + * flat array or an array whose structure parallels the $form array. See + * \Drupal\Core\Render\Element\FormElement for more information.) * * This property is uncacheable. * diff --git a/d8/core/lib/Drupal/Core/Form/FormValidator.php b/d8/core/lib/Drupal/Core/Form/FormValidator.php index afead3d3..26d73920 100644 --- a/d8/core/lib/Drupal/Core/Form/FormValidator.php +++ b/d8/core/lib/Drupal/Core/Form/FormValidator.php @@ -346,7 +346,7 @@ protected function performRequiredValidation(&$elements, FormStateInterface &$fo foreach ($value as $v) { if (!isset($options[$v])) { $form_state->setError($elements, $this->t('An illegal choice has been detected. Please contact the site administrator.')); - $this->logger->error('Illegal choice %choice in !name element.', array('%choice' => $v, '!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'])); + $this->logger->error('Illegal choice %choice in %name element.', array('%choice' => $v, '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'])); } } } diff --git a/d8/core/lib/Drupal/Core/Form/form.api.php b/d8/core/lib/Drupal/Core/Form/form.api.php index b950ccb3..19c2543c 100644 --- a/d8/core/lib/Drupal/Core/Form/form.api.php +++ b/d8/core/lib/Drupal/Core/Form/form.api.php @@ -53,7 +53,7 @@ * such as how many total items were processed. */ function callback_batch_operation($MULTIPLE_PARAMS, &$context) { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = \Drupal::entityTypeManager()->getStorage('node'); if (!isset($context['sandbox']['progress'])) { $context['sandbox']['progress'] = 0; @@ -146,8 +146,6 @@ function callback_batch_finished($success, $results, $operations) { * * @param \Drupal\Core\Ajax\CommandInterface[] $data * An array of all the rendered commands that will be sent to the client. - * - * @see \Drupal\Core\Ajax\AjaxResponse::ajaxRender() */ function hook_ajax_render_alter(array &$data) { // Inject any new status messages into the content area. @@ -194,7 +192,8 @@ function hook_ajax_render_alter(array &$data) { * * @see hook_form_BASE_FORM_ID_alter() * @see hook_form_FORM_ID_alter() - * @see forms_api_reference.html + * + * @ingroup form_api */ function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if (isset($form['type']) && $form['type']['#value'] . '_node_settings' == $form_id) { @@ -237,7 +236,8 @@ function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_stat * @see hook_form_alter() * @see hook_form_BASE_FORM_ID_alter() * @see \Drupal\Core\Form\FormBuilderInterface::prepareForm() - * @see forms_api_reference.html + * + * @ingroup form_api */ function hook_form_FORM_ID_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { // Modification for the form with the given form ID goes here. For example, if @@ -286,6 +286,8 @@ function hook_form_FORM_ID_alter(&$form, \Drupal\Core\Form\FormStateInterface $f * @see hook_form_alter() * @see hook_form_FORM_ID_alter() * @see \Drupal\Core\Form\FormBuilderInterface::prepareForm() + * + * @ingroup form_api */ function hook_form_BASE_FORM_ID_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { // Modification for the form with the given BASE_FORM_ID goes here. For diff --git a/d8/core/lib/Drupal/Core/Image/ImageInterface.php b/d8/core/lib/Drupal/Core/Image/ImageInterface.php index da8496b2..2c953f53 100644 --- a/d8/core/lib/Drupal/Core/Image/ImageInterface.php +++ b/d8/core/lib/Drupal/Core/Image/ImageInterface.php @@ -86,9 +86,12 @@ public function getToolkitId(); * @param string $operation * The operation to be performed against the image. * @param array $arguments - * An associative array of arguments to be passed to the toolkit - * operation, e.g. array('width' => 50, 'height' => 100, - * 'upscale' => TRUE). + * (optional) An associative array of arguments to be passed to the toolkit + * operation; for instance, + * @code + * ['width' => 50, 'height' => 100, 'upscale' => TRUE] + * @endcode + * Defaults to an empty array. * * @return bool * TRUE on success, FALSE on failure. @@ -120,11 +123,11 @@ public function save($destination = NULL); * @param int $height * The height of the new image, in pixels. * @param string $extension - * (Optional) The extension of the image file (e.g. 'png', 'gif', etc.). - * Allowed values depend on the implementation of the image toolkit. + * (optional) The extension of the image file (for instance, 'png', 'gif', + * etc.). Allowed values depend on the implementation of the image toolkit. * Defaults to 'png'. * @param string $transparent_color - * (Optional) The hexadecimal string representing the color to be used + * (optional) The hexadecimal string representing the color to be used * for transparency, needed for GIF images. Defaults to '#ffffff' (white). * * @return bool @@ -176,8 +179,8 @@ public function scaleAndCrop($width, $height); * extension. * * @param string $extension - * The extension to convert to (e.g. 'jpeg' or 'png'). Allowed values depend - * on the current image toolkit. + * The extension to convert to (for instance, 'jpeg' or 'png'). Allowed + * values depend on the current image toolkit. * * @return bool * TRUE on success, FALSE on failure. @@ -231,10 +234,10 @@ public function desaturate(); * The number of (clockwise) degrees to rotate the image. * @param string|null $background * (optional) An hexadecimal integer specifying the background color to use - * for the uncovered area of the image after the rotation. E.g. 0x000000 for - * black, 0xff00ff for magenta, and 0xffffff for white. For images that - * support transparency, this will default to transparent. Otherwise it will - * be white. + * for the uncovered area of the image after the rotation; for example, + * 0x000000 for black, 0xff00ff for magenta, and 0xffffff for white. When + * NULL (the default) is specified, for images that support transparency, + * this will default to transparent; otherwise, it will default to white. * * @return bool * TRUE on success, FALSE on failure. diff --git a/d8/core/lib/Drupal/Core/Language/Language.php b/d8/core/lib/Drupal/Core/Language/Language.php index 46fb892f..675ca477 100644 --- a/d8/core/lib/Drupal/Core/Language/Language.php +++ b/d8/core/lib/Drupal/Core/Language/Language.php @@ -7,6 +7,8 @@ namespace Drupal\Core\Language; +use Drupal\Core\StringTranslation\TranslatableMarkup; + /** * An object containing the information for an interface language. * @@ -151,7 +153,17 @@ public static function sort(&$languages) { $a_weight = $a->getWeight(); $b_weight = $b->getWeight(); if ($a_weight == $b_weight) { - return strnatcasecmp($a->getName(), $b->getName()); + $a_name = $a->getName(); + $b_name = $b->getName(); + // If either name is a TranslatableMarkup object it can not be converted + // to a string. This is because translation requires a sorted list of + // languages thereby causing an infinite loop. Determine the order based + // on ID if this is the case. + if ($a_name instanceof TranslatableMarkup || $b_name instanceof TranslatableMarkup) { + $a_name = $a->getId(); + $b_name = $b->getId(); + } + return strnatcasecmp($a_name, $b_name); } return ($a_weight < $b_weight) ? -1 : 1; }); diff --git a/d8/core/lib/Drupal/Core/Language/LanguageManager.php b/d8/core/lib/Drupal/Core/Language/LanguageManager.php index 092e9fe2..d29b2739 100644 --- a/d8/core/lib/Drupal/Core/Language/LanguageManager.php +++ b/d8/core/lib/Drupal/Core/Language/LanguageManager.php @@ -224,7 +224,7 @@ public function getLanguageSwitchLinks($type, Url $url) { } /** - * @inheritdoc + * {@inheritdoc} */ public static function getStandardLanguageList() { // This list is based on languages available from localize.drupal.org. See @@ -253,6 +253,7 @@ public static function getStandardLanguageList() { 'dz' => array('Dzongkha', 'རྫོང་ཁ'), 'el' => array('Greek', 'Ελληνικά'), 'en' => array('English', 'English'), + 'en-x-simple' => array('Simple English', 'Simple English'), 'eo' => array('Esperanto', 'Esperanto'), 'es' => array('Spanish', 'Español'), 'et' => array('Estonian', 'Eesti'), diff --git a/d8/core/lib/Drupal/Core/Link.php b/d8/core/lib/Drupal/Core/Link.php index f739ad1c..0bf24e84 100644 --- a/d8/core/lib/Drupal/Core/Link.php +++ b/d8/core/lib/Drupal/Core/Link.php @@ -140,11 +140,15 @@ public function setUrl(Url $url) { /** * Generates the HTML for this Link object. * + * Do not use this method to render a link in an HTML context. In an HTML + * context, self::toRenderable() should be used so that render cache + * information is maintained. However, there might be use cases such as tests + * and non-HTML contexts where calling this method directly makes sense. + * * @return \Drupal\Core\GeneratedLink * The link HTML markup. * - * @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Use - * self::toRenderable() instead. + * @see \Drupal\Core\Link::toRenderable() */ public function toString() { return $this->getLinkGenerator()->generateFromLink($this); diff --git a/d8/core/lib/Drupal/Core/Logger/LoggerChannel.php b/d8/core/lib/Drupal/Core/Logger/LoggerChannel.php index 77b84a85..8e0890c9 100644 --- a/d8/core/lib/Drupal/Core/Logger/LoggerChannel.php +++ b/d8/core/lib/Drupal/Core/Logger/LoggerChannel.php @@ -93,9 +93,17 @@ public function log($level, $message, array $context = array()) { $context['request_uri'] = $request->getUri(); $context['referer'] = $request->headers->get('Referer', ''); $context['ip'] = $request->getClientIP(); - if ($this->currentUser) { - $context['user'] = $this->currentUser; - $context['uid'] = $this->currentUser->id(); + try { + if ($this->currentUser) { + $context['user'] = $this->currentUser; + $context['uid'] = $this->currentUser->id(); + } + } + catch (\Exception $e) { + // An exception might be thrown if the database connection is not + // available or due to another unexpected reason. It is more important + // to log the error that we already have so any additional exceptions + // are ignored. } } diff --git a/d8/core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php b/d8/core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php index 67d178cc..a8125d02 100644 --- a/d8/core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php +++ b/d8/core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php @@ -23,10 +23,7 @@ interface LoggerChannelFactoryInterface { public function get($channel); /** - * Adds a logger. - * - * Here is were all services tagged as 'logger' are being retrieved and then - * passed to the channels after instantiation. + * Adds a logger to all the channels. * * @param \Psr\Log\LoggerInterface $logger * The PSR-3 logger to add. diff --git a/d8/core/lib/Drupal/Core/Mail/MailFormatHelper.php b/d8/core/lib/Drupal/Core/Mail/MailFormatHelper.php index 86e85531..6ea977f4 100644 --- a/d8/core/lib/Drupal/Core/Mail/MailFormatHelper.php +++ b/d8/core/lib/Drupal/Core/Mail/MailFormatHelper.php @@ -297,8 +297,8 @@ public static function htmlToText($string, $allowed_tags = NULL) { * Note that we are skipping MIME content header lines, because attached * files, especially applications, could have long MIME types or long * filenames which result in line length longer than the 77 characters limit - * and wrapping that line will break the email format. E.g., the attached file - * hello_drupal.docx will produce the following Content-Type: + * and wrapping that line will break the email format. For instance, the + * attached file hello_drupal.docx will produce the following Content-Type: * @code * Content-Type: * application/vnd.openxmlformats-officedocument.wordprocessingml.document; diff --git a/d8/core/lib/Drupal/Core/Menu/LocalActionManager.php b/d8/core/lib/Drupal/Core/Menu/LocalActionManager.php index eb1e2d03..f98e60e2 100644 --- a/d8/core/lib/Drupal/Core/Menu/LocalActionManager.php +++ b/d8/core/lib/Drupal/Core/Menu/LocalActionManager.php @@ -8,6 +8,9 @@ namespace Drupal\Core\Menu; use Drupal\Core\Access\AccessManagerInterface; +use Drupal\Core\Cache\Cache; +use Drupal\Core\Cache\CacheableDependencyInterface; +use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManagerInterface; @@ -182,8 +185,10 @@ public function getActionsForRoute($route_appears) { $links = array(); /** @var $plugin \Drupal\Core\Menu\LocalActionInterface */ foreach ($this->instances[$route_appears] as $plugin_id => $plugin) { + $cacheability = new CacheableMetadata(); $route_name = $plugin->getRouteName(); $route_parameters = $plugin->getRouteParameters($this->routeMatch); + $access = $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account, TRUE); $links[$plugin_id] = array( '#theme' => 'menu_local_action', '#link' => array( @@ -191,10 +196,22 @@ public function getActionsForRoute($route_appears) { 'url' => Url::fromRoute($route_name, $route_parameters), 'localized_options' => $plugin->getOptions($this->routeMatch), ), - '#access' => $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account, TRUE), + '#access' => $access, '#weight' => $plugin->getWeight(), ); + $cacheability->addCacheableDependency($access); + // For backward compatibility in 8.0.x, plugins that do not implement + // the \Drupal\Core\Cache\CacheableDependencyInterface are assumed + // to be cacheable forever. + if ($plugin instanceof CacheableDependencyInterface) { + $cacheability->addCacheableDependency($plugin); + } + else { + $cacheability->setCacheMaxAge(Cache::PERMANENT); + } + $cacheability->applyTo($links[$plugin_id]); } + $links['#cache']['contexts'][] = 'route'; return $links; } diff --git a/d8/core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php b/d8/core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php index da16e918..eda4a878 100644 --- a/d8/core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php +++ b/d8/core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php @@ -8,7 +8,6 @@ namespace Drupal\Core\Menu\Plugin\Block; use Drupal\Core\Block\BlockBase; -use Drupal\Core\Cache\Cache; use Drupal\Core\Menu\LocalActionManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -84,18 +83,8 @@ public function defaultConfiguration() { public function build() { $route_name = $this->routeMatch->getRouteName(); $local_actions = $this->localActionManager->getActionsForRoute($route_name); - if (empty($local_actions)) { - return []; - } return $local_actions; } - /** - * {@inheritdoc} - */ - public function getCacheContexts() { - return Cache::mergeContexts(parent::getCacheContexts(), ['route']); - } - } diff --git a/d8/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php b/d8/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php index 067e76a4..5cda9be0 100644 --- a/d8/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php +++ b/d8/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php @@ -32,9 +32,9 @@ public function getContextData(); /** * Adds a dependency on an object: merges its cacheability metadata. * - * E.g. when a context depends on some configuration, an entity, or an access - * result, we must make sure their cacheability metadata is present on the - * response. This method makes doing that simple. + * For example, when a context depends on some configuration, an entity, or an + * access result, we must make sure their cacheability metadata is present on + * the response. This method makes doing that simple. * * @param \Drupal\Core\Cache\CacheableDependencyInterface|mixed $dependency * The dependency. If the object implements CacheableDependencyInterface, diff --git a/d8/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/d8/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index 558556d2..26b71617 100644 --- a/d8/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/d8/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -289,7 +289,7 @@ protected function findDefinitions() { * Invokes the hook to alter the definitions if the alter hook is set. * * @param $definitions - * The discovered plugin defintions. + * The discovered plugin definitions. */ protected function alterDefinitions(&$definitions) { if ($this->alterHook) { diff --git a/d8/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php b/d8/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php index 6bc3bbbf..8cb4888d 100644 --- a/d8/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/d8/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -120,13 +120,13 @@ protected function getPluginNamespaces() { if ($this->namespaceSuffix) { foreach ($this->rootNamespacesIterator as $namespace => $dirs) { // Append the namespace suffix to the base namespace, to obtain the - // plugin namespace. E.g. 'Drupal\Views' may become + // plugin namespace; for example, 'Drupal\Views' may become // 'Drupal\Views\Plugin\Block'. $namespace .= $this->namespaceSuffix; foreach ((array) $dirs as $dir) { // Append the directory suffix to the PSR-4 base directory, to obtain - // the directory where plugins are found. - // E.g. DRUPAL_ROOT . '/core/modules/views/src' may become + // the directory where plugins are found. For example, + // DRUPAL_ROOT . '/core/modules/views/src' may become // DRUPAL_ROOT . '/core/modules/views/src/Plugin/Block'. $plugin_namespaces[$namespace][] = $dir . $this->directorySuffix; } diff --git a/d8/core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php b/d8/core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php index 97ea3746..058c752c 100644 --- a/d8/core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php +++ b/d8/core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php @@ -47,8 +47,8 @@ class YamlDiscovery implements DiscoveryInterface { * Construct a YamlDiscovery object. * * @param string $name - * The file name suffix to use for discovery. E.g. 'test' will become - * 'MODULE.test.yml'. + * The file name suffix to use for discovery; for example, 'test' will + * become 'MODULE.test.yml'. * @param array $directories * An array of directories to scan. */ diff --git a/d8/core/lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php b/d8/core/lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php index 2957dc04..332e740a 100644 --- a/d8/core/lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php +++ b/d8/core/lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php @@ -30,8 +30,8 @@ class YamlDiscoveryDecorator extends YamlDiscovery { * @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface $decorated * The discovery object that is being decorated. * @param string $name - * The file name suffix to use for discovery. E.g. 'test' will become - * 'MODULE.test.yml'. + * The file name suffix to use for discovery; for instance, 'test' will + * become 'MODULE.test.yml'. * @param array $directories * An array of directories to scan. */ diff --git a/d8/core/lib/Drupal/Core/Plugin/PluginFormInterface.php b/d8/core/lib/Drupal/Core/Plugin/PluginFormInterface.php index fee05ec5..06dbbad6 100644 --- a/d8/core/lib/Drupal/Core/Plugin/PluginFormInterface.php +++ b/d8/core/lib/Drupal/Core/Plugin/PluginFormInterface.php @@ -27,8 +27,7 @@ interface PluginFormInterface { * callback and build the rest of the form in the callback. By the time the * callback is executed, the element's #parents and #array_parents properties * will have been set by the form API. For more documentation on #parents and - * #array_parents, see - * https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/8. + * #array_parents, see \Drupal\Core\Render\Element\FormElement. * * @param array $form * An associative array containing the initial structure of the plugin form. diff --git a/d8/core/lib/Drupal/Core/Render/Element/HtmlTag.php b/d8/core/lib/Drupal/Core/Render/Element/HtmlTag.php index f2bcacf7..5ec0d3f7 100644 --- a/d8/core/lib/Drupal/Core/Render/Element/HtmlTag.php +++ b/d8/core/lib/Drupal/Core/Render/Element/HtmlTag.php @@ -16,6 +16,24 @@ /** * Provides a render element for any HTML tag, with properties and value. * + * Properties: + * - #tag: The tag name to output. + * - #attributes: (array, optional) HTML attributes to apply to the tag. The + * attributes are escaped, see \Drupal\Core\Template\Attribute. + * - #value: (string, optional) A string containing the textual contents of + * the tag. + * - #noscript: (bool, optional) When set to TRUE, the markup + * (including any prefix or suffix) will be wrapped in a