From 4939cdce06722f9355563b71bc83e054f2e77d62 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Mon, 6 Jan 2025 16:13:26 +1300 Subject: [PATCH] API Remove deprecated API --- src/Shortcodes/ImageShortcodeProvider.php | 23 ------------- src/Storage/DBFile.php | 1 - .../Shortcodes/ImageShortcodeProviderTest.php | 34 ------------------- 3 files changed, 58 deletions(-) diff --git a/src/Shortcodes/ImageShortcodeProvider.php b/src/Shortcodes/ImageShortcodeProvider.php index af5307b9..f9f9fc60 100644 --- a/src/Shortcodes/ImageShortcodeProvider.php +++ b/src/Shortcodes/ImageShortcodeProvider.php @@ -7,7 +7,6 @@ use SilverStripe\Assets\Image; use SilverStripe\Core\Flushable; use SilverStripe\Core\Injector\Injector; -use SilverStripe\Dev\Deprecation; use SilverStripe\View\Parsers\ShortcodeHandler; use SilverStripe\View\Parsers\ShortcodeParser; @@ -150,28 +149,6 @@ public static function handle_shortcode($args, $content, $parser, $shortcode, $e return $markup; } - /** - * Construct and return HTML image tag. - * - * @deprecated 2.3.0 - */ - public static function createImageTag(array $attributes) : string - { - Deprecation::notice('2.3.0', 'Will be removed without equivalent functionality to replace it.'); - $preparedAttributes = ''; - foreach ($attributes as $attributeKey => $attributeValue) { - if (strlen($attributeValue ?? '') > 0 || $attributeKey === 'alt') { - $preparedAttributes .= sprintf( - ' %s="%s"', - $attributeKey, - htmlspecialchars($attributeValue ?? '', ENT_QUOTES, 'UTF-8', false) - ); - } - } - - return ""; - } - /** * Regenerates "[image id=n]" shortcode with new src attribute prior to being edited within the CMS. * diff --git a/src/Storage/DBFile.php b/src/Storage/DBFile.php index 794a30ad..42de943b 100644 --- a/src/Storage/DBFile.php +++ b/src/Storage/DBFile.php @@ -8,7 +8,6 @@ use SilverStripe\Control\Director; use SilverStripe\Core\Injector\Injector; use SilverStripe\Forms\FormField; -use SilverStripe\Dev\Deprecation; use SilverStripe\ORM\FieldType\DBComposite; use SilverStripe\Core\Validation\ValidationException; use SilverStripe\Core\Validation\ValidationResult; diff --git a/tests/php/Shortcodes/ImageShortcodeProviderTest.php b/tests/php/Shortcodes/ImageShortcodeProviderTest.php index 6951ed0c..9243d9aa 100644 --- a/tests/php/Shortcodes/ImageShortcodeProviderTest.php +++ b/tests/php/Shortcodes/ImageShortcodeProviderTest.php @@ -472,40 +472,6 @@ public function testWhiteIsConfigurable() ); } - public static function gettersAndSettersProvider(): array - { - return [ - 'image without special characters' => [ - 'My alt text', - [ - 'src' => 'http://example.com/image.jpg', - 'alt' => 'My alt text', - 'title' => 'My Title', - 'width' => '300', - 'height' => '200', - 'class' => 'leftAlone ss-htmleditorfield-file image', - ], - ], - 'image with special characters' => [ - 'My alt text & special character', - [ - 'src' => 'http://example.com/image.jpg', - 'alt' => 'My alt text & special character', - 'title' => 'My Title & special character', - 'width' => '300', - 'height' => '200', - 'class' => 'leftAlone ss-htmleditorfield-file image', - ] - ] - ]; - } - - #[DataProvider('gettersAndSettersProvider')] - public function testCreateImageTag(string $expected, array $attributes) - { - $this->assertEquals($expected, ImageShortcodeProvider::createImageTag($attributes)); - } - /** * This method will assert that the $tag will contain an image with specific attributes and values *