Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The commercial theme for Galleria "twelve" extends Galleria core with more options.
This patch adds support for these options.
Comment | File | Size | Author |
---|---|---|---|
support_twelves_options.patch | 1.24 KB | Bevan |
Comments
Comment #1
miro_dietikerSince every custom theme might add some new options, this possibly needs a plugin hook...
It's already confusing to set options while you don't know if a theme supports this or not...
Any suggestion about extensibility?
Comment #2
kroimon CreditAttribution: kroimon commentedI think we should support the extended options for the "official" themes out of the box, but they should only be visible when the belonging theme is installed.
So thanks for your patch, Bevan. I'll have a look at the other theme's options asap.
@miro_dietiker: The problem with a plugin hook is: Do you really want to install and enable a new module for every custom theme just to have support for the theme-specific options?
Comment #3
Bevan CreditAttribution: Bevan commentedI think a "custom option" option would be useful for custom themes and more obscure public themes.
I agree that these options should only be exposed by themes that support them.
I wonder if there is a way to parse the theme's JS from PHP and work out what the options are. Perhaps if the library can be instantiated client-side in a hidden iframe or div and the keys of
galleria.options
can be sent back to the server via AJAX?Comment #4
miro_dietikerSince users are generally free in implementing a plugin and what it supports, the code might be diffrent from case to case.
We'll need to define a way in how to define the option.
We better define some additional file format (e.g. containing some JSON data).
Comment #5
kroimon CreditAttribution: kroimon commented@Bevan: Well, there IS a "custom option". Just type in any option name you want instead of selecting one from the drop-down list! You get a text input for each unknown option. If you need boolean values, enter "true" or "false", they will be converted accordingly.
Comment #6
Bevan CreditAttribution: Bevan commentedIf you are going to require that each theme have an "option definition list" defined in code, that will always be specific to Drupal, so you might as well do it in PHP in the module, or in custom modules via
hook_galleria_options()
orCUSTOM.galleria.inc
.However you can retrieve the list of options from the javascript file by letting the admin's browser parse the file for you, as I alluded to in comment #3. It's tricky, but manageable. The possible options get stored in the database.
galleria/get-options
andgalleria/set-options
maintenance-page.tpl.php
)Drupal.settings
(or equivalent) with the list of hard-coded options. i.e.array_keys(galleria_option_elements())
_options
property from the Galleria object_options
.galleria/set-options
.galleria/set-options
, save the options and their types (e.g. Boolean, Integer, String) to the database.So there is. I had not noticed the feature. I think it could be made more notice-able in the UI.
Comment #7
kroimon CreditAttribution: kroimon commentedThe problem with the dynamic loading idea is that we would just have more option names in the select box, but noone would know what they are for, because we don't get any description or documentation for them.
So I think the only manageable way is to add them manually to the list, maybe depending on which theme is selected.
Well... how? Currently, there is the "Select or enter:" text next to the "Add option" button, and it is selected by default! You have to manually select an option for the input field to vanish...
Comment #7.0
kroimon CreditAttribution: kroimon commentedAdding a URL to the demo for the twelve theme.