core/modules/hal/config/install/hal.settings.yml | 11 +++++++---- core/modules/hal/config/schema/hal.schema.yml | 2 +- core/modules/hal/hal.install | 2 +- core/modules/hal/src/Normalizer/FileEntityNormalizer.php | 2 +- core/modules/hal/tests/src/Functional/FileDenormalizeTest.php | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/modules/hal/config/install/hal.settings.yml b/core/modules/hal/config/install/hal.settings.yml index 8e8ef71..c62cb6a 100644 --- a/core/modules/hal/config/install/hal.settings.yml +++ b/core/modules/hal/config/install/hal.settings.yml @@ -1,8 +1,11 @@ # Set the domain for HAL type and relation links. # If left blank, the site's domain will be used. link_domain: ~ -# Before Drupal 8.5, the file URI field value was overridden to only return the -# full file URL. The default for new sites is now to return the actual URI value -# as well as a root relative file path. Enable this setting to use the previous -# behavior. +# Before Drupal 8.5, the File entity 'uri' field value was overridden to return +# the absolute file URL instead of the actual (stream wrapper) URI. The default +# for new sites is now to return the actual URI as well as a root-relative file +# URL. Enable this setting to use the previous behavior. For existing sites, +# the previous behavior is kept by default. +# @see hal_update_8501() +# @see https://www.drupal.org/node/2925783 bc_file_uri_as_url_normalizer: false diff --git a/core/modules/hal/config/schema/hal.schema.yml b/core/modules/hal/config/schema/hal.schema.yml index b70f47e..cad1bdb 100644 --- a/core/modules/hal/config/schema/hal.schema.yml +++ b/core/modules/hal/config/schema/hal.schema.yml @@ -8,4 +8,4 @@ hal.settings: label: 'Domain of the relation' bc_file_uri_as_url_normalizer: type: boolean - label: 'Whether to retain pre Drupal 8.5 behavior of normalizing file URI values as a full URL.' + label: 'Whether to retain pre Drupal 8.5 behavior of normalizing the File entity "uri" field value to an absolute URL.' diff --git a/core/modules/hal/hal.install b/core/modules/hal/hal.install index 5741c12..8794484 100644 --- a/core/modules/hal/hal.install +++ b/core/modules/hal/hal.install @@ -41,5 +41,5 @@ function hal_update_8501() { ->set('bc_file_uri_as_url_normalizer', TRUE) ->save(TRUE); - return t('BC Mode has been enabled for file URI normalization. Only the full file URL will be returned read the change record for more information about opting out of this behavior.'); + return t('Backwards compatibility mode has been enabled for File entities\' HAL normalization of the "uri" field. Like before, it will continue to return only the absolute file URL. If you want the new behavior, which returns both the stored URI and a root-relative file URL, read the change record to learn how to opt in.'); } diff --git a/core/modules/hal/src/Normalizer/FileEntityNormalizer.php b/core/modules/hal/src/Normalizer/FileEntityNormalizer.php index d673a71..43a0d3c 100644 --- a/core/modules/hal/src/Normalizer/FileEntityNormalizer.php +++ b/core/modules/hal/src/Normalizer/FileEntityNormalizer.php @@ -31,7 +31,7 @@ class FileEntityNormalizer extends ContentEntityNormalizer { protected $httpClient; /** - * The hal settings config. + * The HAL settings config. * * @var \Drupal\Core\Config\ImmutableConfig */ diff --git a/core/modules/hal/tests/src/Functional/FileDenormalizeTest.php b/core/modules/hal/tests/src/Functional/FileDenormalizeTest.php index a742c49..9c00902 100644 --- a/core/modules/hal/tests/src/Functional/FileDenormalizeTest.php +++ b/core/modules/hal/tests/src/Functional/FileDenormalizeTest.php @@ -26,8 +26,8 @@ class FileDenormalizeTest extends BrowserTestBase { protected function setUp() { parent::setUp(); - // Override the default configuration to the hal BC setting is enabled, to - // return the full URL value as the file URI 'value'. + // @todo Remove this work-around in https://www.drupal.org/node/1927648. + // @see hal_update_8501() \Drupal::configFactory() ->getEditable('hal.settings') ->set('bc_file_uri_as_url_normalizer', TRUE)