Posted by Michelle on June 20, 2009 at 9:27pm
| Project: | Advanced Forum |
| Version: | 6.x-2.x-dev |
| Component: | Styles |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
Currently you need to implement a hook to add a completely new style. This is a barrier for non programmers. Adding "themes/advanced_forum" as an alternate location would mean styles could simply be dropped in.
Michelle
Comments
#1
Whoops, forgot I had an issue for this. Note to self: look at code in #400158: Simple style installation
Michelle
#2
Expanding this issue with the whole plan:
*-- Registering styles
* Modules can return directories containing styles
* AF will register the advanced_forum/styles directory as well as themes/advanced_forum_styles
* Each style has a .info
- name = NAME
- description = DESCRIPTION
- version = AF VERSION (ie: 2.x)
- base style = BASE STYLE
* AF scans the given directories for .info files to assemble information about styles in them
*-- Style inheritance
* Each style states the style it is based on, if any
* Style directories area added to the theme registry paths in order so template discovery falls back thru
* CSS files are loaded looking first at the active theme, then the active style, then back up the chain of parent styles
*-- Admin selection of styles
* Choose default style for site
* Choose style for each theme (optional)
* Permission to allow user to choose their own theme (optional)
*-- Deciding style to use
* Look first for user specific style
* Look second to theme specific style
* Look third to default style for site
#3
This is what the included style structure will look like:
Naked
* Inherits from: Nothing
* Files:
- Info
- Structure
- Images
- All tpls
Naked Stacked
* Inherits from: Naked
* Files:
- Info
- Structure (adjustements to stack the AP)
- Author pane tpl
Boxy
* Inherits from Naked
* Files:
- Info
- Style
Boxy Stacked
* Inherits from: Naked Stacked, Boxy
* Files:
- Info
Blue Lagoon
* Inherits from Naked
* Files:
- Info
- Style
- Images
Blue Lagoon Stacked
* Inherits from Naked Stacked, Blue Lagoon
* Files:
- Info
#4
Did a massive commit that does quite a bit of this. It adds in a CTools dependency as well. Unfortunately, there is either a bug in CTools or something wrong with how I'm using it so there's a critical bug in it that makes the 2.x branch unusable until I can get it fixed. Should have this finished up and stable again in a few days.
Michelle
#5
Update. Here's what's left to do:
* Revamp the settings page where you choose the style to allow for style per theme as well as style per site
* Add permission to allow user to choose their own theme
*-- This will require a change when deciding style to use:
* Look first for user specific style
* Look second to theme specific style
* Look third to default style for site
#6
Renaming to reflect the remaining items. This may end up waiting until 3.x as it's not a critical feature.
Michelle
#7
Maybe per type as well? Not sure on this... Might be overkill. I was just thinking I'd like to use stacked for my forums but maybe a simpler, non stacked style for actual comments in other places.
Michelle
#8
Postponing... This is going to wait for 3.x
Michelle
#9
One year and a half over, is it still difficult to add this? I think per user/type style is not a critical feature, but per theme style is. I'm developing a mobile theme and it's really necessary. I can't just simply override CSS, because a lots of markup have to be changed in jQuery Mobile, and in general, a more simple markup for mobile version is preferred.
Technically, is there any blocker issue? I imagine move the styles selection to the theme settings page (general and theme-specific settings pages).
#10
If this is important to you, feel free to submit a patch. Otherwise, please leave my status alone. I can only do so much and I made the decision to postpone this one.
Michelle
#11
Yes, I ask for help so that I can start working on this (e.g. submit a patch), now I don't have any clue (after spending time reading code). What should I do to change the forum style to xxx at the run time?
#12
#13
You'll need to add a new UI in the AF settings that allows you to select a style/theme combination. Then something in the code that checks what style to use that looks at that instead of the variable it's using now. I don't have anything more detailed than that without digging into the code and I need to focus on the alpha blockers right now.
If you want to work on it, great, but your post gave no indication of it. You simply chided me for not having done it and said it was important to you which is all fine and good but wishing doesn't write code.
Michelle
#14
Organizing the queue...
Michelle
#15
Ok, we should modify the function advanced_forum_get_current_style() in includes/style.inc to return the appropriate style.
Now, the modification of theme settings page. In D7 it's easier with hook_form_system_theme_settings_alter(). Let me see how to do it in D6.
#16
#17
Well, I have to say I'm impressed that you followed through with a patch. Unfortunately, you put the setting on the system theme page, which I was trying to avoid doing, and the main reason this has been delayed so long. I didn't want to be hasty, though, so I discussed it with the devs on IRC and the consensus was that putting it on the system theme page isn't a good idea.
So that puts us back to needing a decent UI that can live on the AF settings page, which is where it was stuck before.
Michelle
#18
Michelle, could you tell me reasons that the style selection should be on AF page? As I can see that the poor color.module intrude into the theme settings page, too. And for per user style, it should go in user/%/edit page, where users select their theme.
#19
Sorry, but finally I chose to make a theme-dependant AF style and not go in this way.
#20
Color module is core as well.
Not everyone is going to want theme specific styles. In fact, that's probably a rare edge case since most sites only have one theme. I want to support that edge case at some point but not at the expense of making the UI worse.
This is something that needs to given careful thought of how best to present it and that is why it was postponed. The actual code needed to handle fetching the correct theme is easy; making a sensible UI is not.
I appreciate you trying. If nothing else, you have the code there you can use on your own site.
Michelle
#21
Without the UI, to use a special style in a specific theme is simple and doesn't need a module patch, just put one line into that THEMENAME/template.php:
$GLOBALS['conf']['advanced_forum_style'] = 'my_super_style';