XF 2.2 How to add an extra image driver?

Kirby

Well-known member
I'd like to add an extra image driver.
This seems possible as the image manager is prepared to handle multiple drivers and extra drivers can be added via container imageManager.extraDrivers.

However, the admin GUI to configure the default driver does give me some headache:
The option does use a PHP callback and as the entity does not extend the callback class before executing the callback I can't seem to find an easy way to make this extra driver appear there and stikl have the setting validated properly

My thoughts so far :

  1. I could leave the option untouched and set the default driver via container imageManager.defaultDriver, effectively making the option unfunctional
  2. I could patch the option definition and modify the callback
  3. I could extend XF\Entity\Option and override method renderDisplayCallback to make the callback use class extensions
    This in turn would allow me to extend XF\Option\ImageLibrary and add the necessary code
  4. I could just add my driver to template option_template_imageLibrary without validation if it can be used

Currently I'd favour option # 3, but basically none of those approaches does not seem kinda hacky to me :(

Any other ideas or hints how this is supposed to work @Chris D ?
 
Back
Top Bottom