diff --git a/core/lib/Drupal/Core/Image/Image.php b/core/lib/Drupal/Core/Image/Image.php index ddf93c7..b111486 100644 --- a/core/lib/Drupal/Core/Image/Image.php +++ b/core/lib/Drupal/Core/Image/Image.php @@ -139,7 +139,7 @@ public function save($destination = NULL) { /** * {@inheritdoc} */ - public function apply($operation, array $arguments = []) { + public function apply($operation, array $arguments = array()) { return $this->getToolkit()->apply($operation, $arguments); } @@ -147,77 +147,56 @@ public function apply($operation, array $arguments = []) { * {@inheritdoc} */ public function createNew($width, $height, $extension = 'png', $transparent_color = '#ffffff') { - return $this->apply('create_new', [ - 'width' => $width, - 'height' => $height, - 'extension' => $extension, - 'transparent_color' => $transparent_color, - ]); + return $this->apply('create_new', array('width' => $width, 'height' => $height, 'extension' => $extension, 'transparent_color' => $transparent_color)); } /** * {@inheritdoc} */ public function convert($extension) { - return $this->apply('convert', ['extension' => $extension]); + return $this->apply('convert', array('extension' => $extension)); } /** * {@inheritdoc} */ public function crop($x, $y, $width, $height = NULL) { - return $this->apply('crop', [ - 'x' => $x, - 'y' => $y, - 'width' => $width, - 'height' => $height, - ]); + return $this->apply('crop', array('x' => $x, 'y' => $y, 'width' => $width, 'height' => $height)); } /** * {@inheritdoc} */ public function desaturate() { - return $this->apply('desaturate', []); + return $this->apply('desaturate', array()); } /** * {@inheritdoc} */ public function resize($width, $height) { - return $this->apply('resize', ['width' => $width, 'height' => $height]); + return $this->apply('resize', array('width' => $width, 'height' => $height)); } /** * {@inheritdoc} */ public function rotate($degrees, $background = NULL) { - return $this->apply('rotate', [ - 'degrees' => $degrees, - 'background' => $background, - ]); + return $this->apply('rotate', array('degrees' => $degrees, 'background' => $background)); } /** * {@inheritdoc} */ public function scaleAndCrop($width, $height, $upscale = FALSE) { - return $this->apply('scale_and_crop', [ - 'width' => $width, - 'height' => $height, - 'upscale' => $upscale, - ]); + return $this->apply('scale_and_crop', array('width' => $width, 'height' => $height, 'upscale' => $upscale)); } /** * {@inheritdoc} */ public function scale($width, $height = NULL, $upscale = FALSE) { - return $this->apply('scale', [ - 'width' => $width, - 'height' => $height, - 'upscale' => $upscale, - ]); + return $this->apply('scale', array('width' => $width, 'height' => $height, 'upscale' => $upscale)); } /** diff --git a/core/lib/Drupal/Core/Image/ImageInterface.php b/core/lib/Drupal/Core/Image/ImageInterface.php index a9a408a..ab8cad8 100644 --- a/core/lib/Drupal/Core/Image/ImageInterface.php +++ b/core/lib/Drupal/Core/Image/ImageInterface.php @@ -140,10 +140,11 @@ public function createNew($width, $height, $extension = 'png', $transparent_colo * be based only on the height value. * @param int|null $height * (optional) The target height, in pixels. If this value is null then the - * scaling will be based only on the width value. + * scaling will be based only on the width value. Defaults to NULL. * @param bool $upscale * (optional) Boolean indicating that files smaller than the dimensions will * be scaled up. This generally results in a low quality image. + * Defaults to FALSE. * * @return bool * TRUE on success, FALSE on failure. @@ -166,6 +167,7 @@ public function scale($width, $height = NULL, $upscale = FALSE); * @param bool $upscale * (optional) Boolean indicating that files smaller than the dimensions will * be scaled up. This generally results in a low quality image. + * Defaults to FALSE. * * @return bool * TRUE on success, FALSE on failure. diff --git a/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php b/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php index 4d45df1..fe89b3f 100644 --- a/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php +++ b/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php @@ -78,8 +78,8 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $form['upscale'] = [ '#type' => 'checkbox', '#default_value' => $this->configuration['upscale'], - '#title' => t('Allow Upscaling'), - '#description' => t('Let scale make images larger than their original size'), + '#title' => $this->t('Allow Upscaling'), + '#description' => $this->t('Let scale make images larger than their original size'), ]; return $form; } diff --git a/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php b/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php index d1538f0..bd18a9d 100644 --- a/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php +++ b/core/modules/image/tests/src/Kernel/Migrate/d7/MigrateImageStylesTest.php @@ -32,7 +32,7 @@ protected function setUp() { * Test the image styles migration. */ public function testImageStylesMigration() { - $this->assertEntity('custom_image_style_1', "Custom image style 1", ['image_scale_and_crop', 'image_desaturate'], [['width' => 55, 'height' => 55, 'upscale' => false], []]); + $this->assertEntity('custom_image_style_1', "Custom image style 1", ['image_scale_and_crop', 'image_desaturate'], [['width' => 55, 'height' => 55, 'upscale' => FALSE], []]); $this->assertEntity('custom_image_style_2', "Custom image style 2", ['image_resize', 'image_rotate'], [['width' => 55, 'height' => 100], ['degrees' => 45, 'bgcolor' => '#FFFFFF', 'random' => FALSE]]); $this->assertEntity('custom_image_style_3', "Custom image style 3", ['image_scale', 'image_crop'], [['width' => 150, 'height' => NULL, 'upscale' => FALSE], ['width' => 50, 'height' => 50, 'anchor' => 'left-top']]); } @@ -45,9 +45,9 @@ public function testImageStylesMigration() { * @param string $label * The expected image style label. * @param array $expected_effect_plugins - * An array of expected plugins attached to the image style entity + * An array of expected plugins attached to the image style entity. * @param array $expected_effect_config - * An array of expected configuration for each effect in the image style + * An array of expected configuration for each effect in the image style. */ protected function assertEntity($id, $label, array $expected_effect_plugins, array $expected_effect_config) { $style = ImageStyle::load($id);