This issue is to track the work around adding a way to choose the AMP theme on the AMP configuration screen.

| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2678306-7-amp-theme-selection.patch | 1.74 KB | rainbowarray |
| #4 | 2678306-amp-theme-selection.patch | 1.92 KB | rainbowarray |
Comments
Comment #2
sirkitree commentedComment #3
rainbowarrayComment #4
rainbowarrayThis adds a configuration setting for selecting the theme to use on AMP pages and then uses that configuration in amp_custom_theme, which does the theme switching.
This code is based on how the admin theme switching is handled in core.
Comment #5
mtiftThis is unnecessary because we are using system_settings_form()
Drupal 7 only requires PHP 5.2.5 or higher so you probably shouldn't use short array syntax
Is this a function you think we are going to need elsewhere? It seems weird to uasort the values from a sorting function.
Comment #6
mtiftComment #7
rainbowarray1. Fixed.
2. Fixed.
3. system_modules() prepares a similar list of theme options and relies upon a system_sort_modules_by_info_name callback that does the same sorting. Unfortunately, calling that wasn't working from within the amp module, so I created a similar helper function to do the same thing. So the amp module is essentially handling this the same way core does.
Comment #8
mtiftLooks good to me.
Comment #10
rainbowarrayComment #11
dave reidWe can just reuse system_sort_modules_by_info_name() here, it has the same exact logic as _amp_sort_theme_by_info_name().
Why it wasn't working is that you just have to do this first:
module_load_include('inc', 'system', 'system.admin');Comment #12
dave reidShould this variable_get() call have a default parameter? Or check if the variable is not empty? It seems odd it has a default value in the form above, but not here.
Comment #14
rainbowarrayApplied the changes you suggested. Thanks Dave!