CloudinaryBundle icon indicating copy to clipboard operation
CloudinaryBundle copied to clipboard

Allow configuration of global options

Open artjomsimon opened this issue 5 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