From d595851c75a5372ceeecaacec1678ece3f716b21 Mon Sep 17 00:00:00 2001 From: Aryeh Raber Date: Thu, 25 Jan 2018 22:55:10 +0100 Subject: [PATCH] Add support for shorthand syntax --- addons/SvgOutput/SvgOutputTags.php | 15 +++++++++++---- addons/SvgOutput/meta.yaml | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/addons/SvgOutput/SvgOutputTags.php b/addons/SvgOutput/SvgOutputTags.php index 9e681df..49be864 100644 --- a/addons/SvgOutput/SvgOutputTags.php +++ b/addons/SvgOutput/SvgOutputTags.php @@ -7,19 +7,26 @@ class SvgOutputTags extends Tags { - public function index() + public function __call($name, $args) { - $asset = Asset::find($this->get('url')); + return $this->index(array_get($this->context, $name)); + } + + public function index($url = null) + { + $asset = Asset::find($url ?: $this->get('url')); $class = $this->get('class'); $svg = $asset->disk()->get($asset->path()); $pattern = '/(