Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -7,7 +7,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\file\Entity\File;
use Drupal\file\FileInterface;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\field\FieldConfigInterface;
use Drupal\image\Entity\ImageStyle;
@ -16,6 +16,8 @@ use Drupal\image\Entity\ImageStyle;
* Image style constant for user presets in the database.
*
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
*
* @see https://www.drupal.org/node/1820974
*/
const IMAGE_STORAGE_NORMAL = 1;
@ -23,6 +25,8 @@ const IMAGE_STORAGE_NORMAL = 1;
* Image style constant for user presets that override module-defined presets.
*
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
*
* @see https://www.drupal.org/node/1820974
*/
const IMAGE_STORAGE_OVERRIDE = 2;
@ -30,6 +34,8 @@ const IMAGE_STORAGE_OVERRIDE = 2;
* Image style constant for module-defined presets in code.
*
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
*
* @see https://www.drupal.org/node/1820974
*/
const IMAGE_STORAGE_DEFAULT = 4;
@ -37,6 +43,8 @@ const IMAGE_STORAGE_DEFAULT = 4;
* Image style constant to represent an editable preset.
*
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
*
* @see https://www.drupal.org/node/1820974
*/
define('IMAGE_STORAGE_EDITABLE', IMAGE_STORAGE_NORMAL | IMAGE_STORAGE_OVERRIDE);
@ -44,6 +52,8 @@ define('IMAGE_STORAGE_EDITABLE', IMAGE_STORAGE_NORMAL | IMAGE_STORAGE_OVERRIDE);
* Image style constant to represent any module-based preset.
*
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.0.
*
* @see https://www.drupal.org/node/1820974
*/
define('IMAGE_STORAGE_MODULE', IMAGE_STORAGE_OVERRIDE | IMAGE_STORAGE_DEFAULT);
@ -142,6 +152,9 @@ function image_theme() {
'image_crop_summary' => [
'variables' => ['data' => NULL, 'effect' => []],
],
'image_scale_and_crop_summary' => [
'variables' => ['data' => NULL, 'effect' => []],
],
'image_rotate_summary' => [
'variables' => ['data' => NULL, 'effect' => []],
],
@ -200,7 +213,7 @@ function image_file_download($uri) {
/**
* Implements hook_file_move().
*/
function image_file_move(File $file, File $source) {
function image_file_move(FileInterface $file, FileInterface $source) {
// Delete any image derivatives at the original image path.
image_path_flush($source->getFileUri());
}
@ -208,7 +221,7 @@ function image_file_move(File $file, File $source) {
/**
* Implements hook_ENTITY_TYPE_predelete() for file entities.
*/
function image_file_predelete(File $file) {
function image_file_predelete(FileInterface $file) {
// Delete any image derivatives of this image.
image_path_flush($file->getFileUri());
}
@ -292,10 +305,28 @@ function template_preprocess_image_style(&$variables) {
'#width' => $dimensions['width'],
'#height' => $dimensions['height'],
'#attributes' => $variables['attributes'],
'#uri' => $style->buildUrl($variables['uri']),
'#style_name' => $variables['style_name'],
];
// If the current image toolkit supports this file type, prepare the URI for
// the derivative image. If not, just use the original image resized to the
// dimensions specified by the style.
if ($style->supportsUri($variables['uri'])) {
$variables['image']['#uri'] = $style->buildUrl($variables['uri']);
}
else {
$variables['image']['#uri'] = $variables['uri'];
// Don't render the image by default, but allow other preprocess functions
// to override that if they need to.
$variables['image']['#access'] = FALSE;
// Inform the site builders why their image didn't work.
\Drupal::logger('image')->warning('Could not apply @style image style to @uri because the style does not support it.', [
'@style' => $style->label(),
'@uri' => $variables['uri'],
]);
}
if (isset($variables['alt']) || array_key_exists('alt', $variables)) {
$variables['image']['#alt'] = $variables['alt'];
}
@ -404,7 +435,7 @@ function image_field_storage_config_update(FieldStorageConfigInterface $field_st
if ($file_new && (file_uri_scheme($file_new->getFileUri()) != $field_storage->getSetting('uri_scheme'))) {
$directory = $field_storage->getSetting('uri_scheme') . '://default_images/';
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
file_move($file_new, $directory . $file_new->filename);
file_move($file_new, $directory . $file_new->getFilename());
}
}
@ -442,7 +473,7 @@ function image_field_config_update(FieldConfigInterface $field) {
if ($file_new && (file_uri_scheme($file_new->getFileUri()) != $field_storage->getSetting('uri_scheme'))) {
$directory = $field_storage->getSetting('uri_scheme') . '://default_images/';
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
file_move($file_new, $directory . $file_new->filename);
file_move($file_new, $directory . $file_new->getFilename());
}
}