CloudinaryBundle icon indicating copy to clipboard operation
CloudinaryBundle copied to clipboard

Allow configuration of global options

Open artjomsimon opened this issue 7 years ago • 2 comments

Hi, this PR builds on top of PR #5 , but goes one step further: Allow to configure global options that are evaluated on each of your twig function calls, but can be overwritten optionally.

Example from production:

Before

{{ cloudinary_url('folder/image', {'secure' : true, 'type': 'private', 'sign_url' : true, 'version': globally_set_sha_hash}) }}

After

config.yml:

speicher210_cloudinary:
    url: "cloudinary://%cloudinary_key%:%cloudinary_secret%@%cloudinary_name%"
    options:
      secure: true
      sign_url: true
      type: private
      version: '%release_sha%'

template.html.twig: {{ cloudinary_url('folder/image') }}

You can still set options on a case-by-case basis if you don't want the global options to be evaluated for one particular resource.

artjomsimon avatar Jan 09 '19 12:01 artjomsimon

Ok had to go the other route and introduce the variable consistently in the other functions as well since PHP 5.x didn't allow that $this->a::b syntax.

I'll look into the other failing tests shortly.

artjomsimon avatar Jan 09 '19 17:01 artjomsimon

The options are merged and passed to the various cloudinary functions. It seems that a different approach is needed. This options anyway are intended to be passed to the cloudinary instance.

dragosprotung avatar Jan 09 '19 21:01 dragosprotung