From 9c3395b69c2155c04736c295918aa0e3bb6a7239 Mon Sep 17 00:00:00 2001 From: "Mr.42" Date: Wed, 30 Dec 2020 19:05:02 +0100 Subject: [PATCH] SvgViewInjection --- composer.json | 4 +++- config/params.php | 8 ++++---- src/SvgViewInjection.php | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 src/SvgViewInjection.php diff --git a/composer.json b/composer.json index d21dc99..45df68f 100644 --- a/composer.json +++ b/composer.json @@ -31,10 +31,12 @@ "ext-dom": "*", "yiisoft/aliases": "^1.1.0", "yiisoft/composer-config-plugin": "^1.0", - "yiisoft/html": "^3.0" + "yiisoft/html": "^3.0", + "yiisoft/yii-view": "^3.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", + "httpsoft/http-message": "^1.0", "phpmd/phpmd": "@stable", "phpunit/phpunit": "^9.0", "squizlabs/php_codesniffer": "^3.5", diff --git a/config/params.php b/config/params.php index 2c8fbf7..65565ea 100644 --- a/config/params.php +++ b/config/params.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use YiiRocks\SvgInline\SvgInlineInterface; +use YiiRocks\SvgInline\SvgViewInjection; use Yiisoft\Factory\Definitions\Reference; return [ @@ -11,9 +11,9 @@ 'fill' => 'currentColor', ], - 'yiisoft/view' => [ - 'defaultParameters' => [ - 'svg' => Reference::to(SvgInlineInterface::class), + 'yiisoft/yii-view' => [ + 'injections' => [ + Reference::to(SvgViewInjection::class), ], ], ]; diff --git a/src/SvgViewInjection.php b/src/SvgViewInjection.php new file mode 100644 index 0000000..d8db332 --- /dev/null +++ b/src/SvgViewInjection.php @@ -0,0 +1,33 @@ +svg = $svg; + } + + public function getContentParameters(): array + { + return [ + 'svg' => $this->svg, + ]; + } + + public function getLayoutParameters(): array + { + return [ + 'svg' => $this->svg, + ]; + } +}