Closed Olicek closed 9 years ago
Well, the good news is that you can use this without any change in library :) (it's actually new feature in 2.0). You modified the library only in Macros
class, and you can use custom <path>
parameter without that change, like this:
<img n:src="photoId, 300, 200, path => test-gallery">
Ok, that sounds great! Then, I would have a suggestion. What about that: the Macros implements some interface and by default would be used \DotBlue\WebImages\Macros
. But somewhere (and I don't know where, maybe webimages: macros: MyClass
) I would be able to use my own macro class. It can be more practical to overload default Macros class and use own prepareArguments
. Something like this
class MyMacros extends DotBlue\WebImages\Macros
{
public static function prepareArguments(array $arguments)
{
$arguments = parent::prepareArguments($arguments);
// some my own magic
return $arguments;
}
}
If I needed more parameters, It would be unpractical. Has it some negative impact to library work?
Well, you can override macro directly in latte. This does not make sense for me to have it in the library.
I don't know if you find it interesting. I need it, so I just create pull request and maybe you find it usefull.
This PR add optional parameter path. It's because I use path like
www\gallery\<name-of-gallery\300x200\photoId.jpg
in my gallery folder. Well, the gallery name is set as 4th parameter (optional) in macro.In router I use then
What do you think?