I have been reviewing the code for both the main module and contributed modules and I am trying to provide a patch or module to defining what theme should be used when a modal dialog is used on content or the administration.
When I select to use a different theme for the administration side verses the anon side of the site the modal dialog always uses the primary anon theme.
Here is an example of how to manually define a theme by the path (http://drupal.org/node/324004) however the different modules provide modal dialogs for different elements in the Admin sections.
I was considering on review the code from this module and see if a simple setting form could be build to define the theme to use for all or specific modal dialogs.
http://drupal.org/project/themekey
For now I am going to try specifying the theme in a local version of the modal api module and see where I get.
Comment | File | Size | Author |
---|---|---|---|
#10 | admin-toolbar.tpl_.php_.gz | 366 bytes | emptyvoid |
#7 | modial-frame-theme-01.png | 46.27 KB | emptyvoid |
#7 | modial-frame-theme-02a.png | 49.94 KB | emptyvoid |
#7 | modial-frame-theme-02b.png | 49.96 KB | emptyvoid |
#7 | modial-frame-theme-02c.png | 56.48 KB | emptyvoid |
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedHi,
I would like to keep the Modal Frame API as a tool for devs, so it does not have any settings screen. Anything variable should be implemented by those modules that use the Modal Frame API. So, I'm moving this issue to the Contribs Package.
Here's a few ideas related to theming Modal Frames:
$custom_theme
as you (as a developer) can everywhere else. Also, if there are modules such as Themekey that provide a method to switch themes based on specific rules, then we also have the right tool for user to do it.In summary, I think we do not need another module to select themes for Modal Frames. What we need is ensure that existing tools can also be used under the context of Modal Frames.
Comment #2
markus_petrux CreditAttribution: markus_petrux commentedI'm really tempted to mark this issue as "by design".
Is there any problem with Drupal's
$custom_theme
or using modules such as Themekey? If so, I think we need to find a way to fix those. No need to add yet another method to define rules to switch themes, IMHO.Comment #3
emptyvoid CreditAttribution: emptyvoid commentedYeah I see what you are saying.
Jquery UI Themes
It does make sense to submit requests to the jquery UI module moderators to provide a patch so users can specify themes to use. I already started researching this and the easiest solution is a small settings form that loads the themes for the jquery ui module into a select list and then have a pre-processor function add the theme css resources during pre-precess for the jquery ui module.
-- snip --
Looks like the community is already discussing this and has a patch (not in the dev release yet) http://drupal.org/node/388384
I could also make a bridge module that is just aware of the settings and provides a link or render of the settings form in an admin for modal frame. Maybe called (Modal Frame Theme)?
Modal Dialog Content Theme
As for the ThemeKey module I agree that is where I am going to start. For starters I am going to research different techniques between the themekey and modalapi modules and see where I get. I think I will identify issues with the two very quickly. My current theory is that the themekey module bases the switching of the theme by path or form ID. So as a developer I would have to register every instance of a modal dialog path or form ID. That could be very time consuming and fragile as the developer would have to keep up with each new path and or form ID (such as adding a new module, content type, view, etc). It would be easier if a developer could specify what theme to use and where.
Or maybe a list of registered paths and form IDs that are loaded in the modal frames.
Perhaps I could make a bridge module that is dependent on the themekey module that provides a centralized administration UI as it pertains to modal dialogs? Maybe call it (Modal Frame Content Theme)
ADMIN V2 Menu Conflict
http://drupal.org/project/admin
I am working on a design pattern related to the issues I highlighted above it includes using the ADMIN module V2 with the modal dialog. The problem is that all modal dialogs render the admin menu when they appear and I am thinking of creating another bridge module that disables the rendering of the admin menu within a modal dialog. This could also be a setting displayed in an administration ui too. (Modal Frame ADMIN Settings)
I understand your reasons for not having a settings interface for the contributed modules.. but we could have a Modal Frame UI module that is optional (similar in concept to views and panels) it isn't required and can be turned off. So developers can hide it from clients if they so choose.
Contributed Module Ideas
I am also researching a few ideas and wanted to know if I should post a new issue for each with status updates and code once I get a first build. Here is what I am thinking about:
The current Modal frame contrib module provides hooks for editing blocks in-context. Need to research node, field group, cck field, and views modal dialog editing in-context to a page.
Features Ideas
My first pass is providing the ability to edit content in-context for a page. Once I have accomplished that if I get the theme modules working is to provide theme selection per content type, field group, cck field, and or view. Of course the first build will just be to specify a theme for all modal frames.
Could we keep this issue open so I can post updates, images, and code as I progress through the testing stage?
Comment #4
markus_petrux CreditAttribution: markus_petrux commentedRe: "Could we keep this issue open so I can post updates, images, and code as I progress through the testing stage?"
Sure. No problem. :)
The basic idea behind this Modal Frame Contrib Package project is that it is open to ideas. Everyone is welcome to contribute. Aside from posting stuff, it would also be nice reviews from third parties, other users that may also find new stuff useful, and that should be enough to include new stuff to the package. Obviously, new stuff can also be implemented in separate projects. One of the goals here is to provide real life examples that may help others implement the Modal Frame API in their projects.
Still, I think the Modal Frame API itself should remain a tool for developers. No UI. Only APIs that can be reused elsewhere.
Comment #5
markus_petrux CreditAttribution: markus_petrux commentedOne thing to consider when trying to easy the use of jQuery UI themes, since this is now in Drupal 7 core, it might be important to follow how it evolves. For example, here's an issue in the Drupal 7 queue:
- #583400: jQuery UI libraries are loading too much CSS that needs to be reverted / Allow jQuery UI themes to be swappable
I guess whatever is done in D7 around jQuery UI, could be backported to D6 under the context of the jquery_ui module.
Comment #6
emptyvoid CreditAttribution: emptyvoid commentedUpdate
Jquery UI Themes
Applying the patch detailed in this issue adds the ability to select jquery themes for a dialog. (http://drupal.org/node/388384)
To accomplish it I had to:
1) modify the css in the theme to not squash the css loaded for the dialog.
2) Add class names to the modalframe-page.tpl.php
This enables the themes to be loaded (see attached screen shots)
Modal Dialog Content Theme
Actually it was quite easy to setup themes per paths for the modal frames. It still requires lots of configuration but once you identify the paths updating it is trivial.
http://drupal.org/project/themekey
In my test case I am defining the theme for the noderelationships module (http://drupal.org/project/noderelationships)
I added the following themekey theme switching rules:
a) Drupal:path = noderelationships/search/% (theme)
b) Drupal:path = noderelationships/create/% (theme)
The last bug I am working on is the ADMIN menu (I minimized it for the screen shots [top right corner]) is displayed on every dialog.
So this is encouraging!
Comment #7
emptyvoid CreditAttribution: emptyvoid commentedArg the images I uploaded were works in progress the attached are the final examples once I fixed some css collisions.
Comment #8
markus_petrux CreditAttribution: markus_petrux commentedRe: "1) modify the css in the theme to not squash the css loaded for the dialog."
You can do this using Overriding style sheets from modules and base themes.
Re: "2) Add class names to the modalframe-page.tpl.php"
You can copy modalframe-page.tpl.php to your theme folder and apply the modifications there.
Re: "b) Drupal:path = noderelationships/create/% (theme)"
This path has been changed in latest version of Node Relationships. It now uses regular node/add/[type] path (to be more compatible with other modules that rely on the original Drupal path to do their job on the node form properly), with a couple of additional query arguments. See: #668922: Redirect to node/add/[type] when creating nodes within the Modal Frame
Comment #9
emptyvoid CreditAttribution: emptyvoid commentedThanks for the update:
CSS Override
Yeah it looks very easy to override the css for the module in the theme.
So I would copy the css from the module into my theme directory and register it in the info file like so:
stylesheets[all][] = parent.css
stylesheets[all][] = modalframe.parent.css
Template File
Yep the example I provided I moved into my current theme. The important thing is to put the template file in the correct theme. Defining the theme via ThemeKey means you must put the template file in the correct theme (In my case the Rubik theme).
Theme Key Path
I see so when I get the newest update I may need to add this path instead.
Drupal:path = node/add/%?noderelationships_referrer_type=%&noderelationships_field_name=field_noderefence | (theme)
Sweet! Thanks I will battle forward to try and get the ADMIN module conflict solved.
Comment #10
emptyvoid CreditAttribution: emptyvoid commentedOk solution for ADMIN integration, the solution isn't very elegant but it works.
From the ADMIN module copy the [admin/theme/admin-toolbar.tpl.php] template file and move it into your theme folder.
Add the following line and the admin menu won't render in modal frames.
--
I researched the ADMIN module and found two locations where I tried to "short circuit" the loading of the menu.
admin_init()
This hook loads all of the admin CSS and JS resources into the head of the page template.
admin_theme_registry_alter()
This hook add a process_pre_page function that loads blocks of content into the menu block prior to any of the page preprocess functions in the preprocessor stack.
admin_footer()
This hook loads the rendered ADMIN container divs and blocks into the footer of the page template.
--
So I attempted to create a bridge module modalframe_admin that would stop loading at any of the three hook locations based on the state of the global variables defined by the modal frame api. Sadly I couldn't crack that nut :(
So the solution you see if what I could get to work without modifying the ADMIN module. The short coming of this tactic is all of the CSS and JavaScript for the ADMIN menu is loaded into the modal frame even though I don't render the container and divs. I don't like my solution as it is pretty inefficient and may have performance issues on larger Drupal sites with 1,000 to 10,000 of concurrent users.
Comment #11
markus_petrux CreditAttribution: markus_petrux commentedI have switched your issue in the admin module queue into a feature request.
- #675300: Provide a method to disable the output of the toolbar programmatically
Once they provide something in that direction, I can "touch" the Modal Frame API to disable the output of the admin toolbar in modal frames.
Comment #12
markus_petrux CreditAttribution: markus_petrux commentedBTW, it seems this stuff could be documented on a book page (linked to from the project page of the Modal Frame API)?
If so, I could add a page under http://drupal.org/handbook/config/contribmodules for the Modal Frame API. Well, not really sure if that's the correct location, because I'm not up to date with latest changes in handbooks, but anyway, that's the idea.
Comment #13
markus_petrux CreditAttribution: markus_petrux commentedI'm movinf this issue to the Modal Frame API. We have now a page in the Drupal handbooks:
- Modal Frame API How to
Maybe a child page could be added to describe the methods outlined in this issue? Could you please help me on that? I think all you need to do is create a child page in that document (the link is at the bottom).
Comment #14
markus_petrux CreditAttribution: markus_petrux commentedAdded a section about theming to the above mentioned handbook paga. It just contains a link to this issue, but it's a start.
Comment #16
Michsk CreditAttribution: Michsk commentedI didn't want to open a new issue since this has got to do with this issue. Wondering how the theme the outside of the modal. How could i wrap the modalframe in another div/table?