Reviewing the wishlist I've seen the 'Overlay example for Form example (D7)'. Overlay is for administration purposes (at least currently, in fact the permission required is: Access the administrative overlay (View administrative pages in the overlay). Considering the overlay API, any path within 'admin/*' is considered an administrative page and will show up in overlay, but first, overaly should have been activated, and the user requires the permission. So, doing this way in form example, from the users perspective we should advise that without the module and the permission this example would not work, and from the module code is as easy as put a form in admin/whatever.

I'm wondering if this is what we want to do, or we should dig a liitle bit into the overlay API for this example, I mean, registering a path with hook_admin_paths() or altering existing admin paths with hook_admin_paths_alter(). Anyway, overlay has too many issues open right now the I'd suggest to wait for this one.

CommentFileSizeAuthor
#14 admin_overlay_example.zip1.58 KBilo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

I suspect the idea was to demonstrate a modal dialog like Overlay module does, rather than just using something that is an admin thing. Although we should add an overlay into menu example (I believe you just have to add some new magic to the menu to make the overlay fire).

ilo’s picture

AFAIK, using hook_admin_paths() or hook_admin_paths_alter() you may include the paths you want into the 'admin paths' that will use overlay, the problem is that I don't know why the purpose of overlay is limited to admin (as long as the permission name itself is 'View administrative pages in the overlay' ). That's the only magic, rfay. you can put user/register in that array, provide permissions to anonymous users, and the registration form will show up in overlay.

And I don't think we must go into a thickbox or other contrib implementation at all.

ilo’s picture

Need additional opinions on this one. Overlay example has no candidate code nor ideas to be created as a module, it is just a hook to add paths to the overlayed collection.

d0minar’s picture

Until there is a solution to this, I'm hacking core.
Comment out line 143 (overlay_close_dialog($current_path);) in overlay.module and yo will be able to use anything with overlay

eg. http://localhost/#overlay=user

J++

ilo’s picture

No, definitelly this is not the way to go at all, and of course this is not an example solution.

As I said, as long as you include the paths (and this also applies for 'user') using the described hooks and provide permission, it must work. There is no need to remove or touch a single line of core when you understand the provided solution.

mcjim’s picture

I don't quite understand (yet) why overlay is limited to admin paths, either.

Just starting building a site in D7 and had assumed it would be easy enough to include the overlay for one or two pages, but using hook_admin_paths() or hook_admin_paths_alter() feels wrong: they're not admin pages!

I haven't tracked down a historical reason why it's limited to admin pages, but tif I find one I'll post back here.

Anonymous’s picture

I think that the reason overlay can only be used on admin pages is based on the user testing they did in the Drupal 7 cycle. The UX team found that users didn't understand the difference between administration pages and pages that their users could see. I think that the overlay is an attempt to make that difference more clear.

I think that another modal solution might be necessary and desirable for non-admin situations.

Anonymous’s picture

Marked #863304: Develop Overlay Example as a duplicate.

mcjim’s picture

Thanks for the answer, Lin.

It seems an overly-cautious decision, to me, though. If there's an overlay implementation in core, it makes sense to reuse it.

chrisroditis’s picture

Version: » 7.x-1.x-dev

In my use case I don't like admin/* pages in overlay mode so I used hook_admin_paths_alter to turn off overlay, but I have node/add and other user-side pages in overlay using hook_admin_paths. My problem with this approach is the admin/* pages stopped using the administration theme since they are no longer considered admin pages.

So +1 on a way to reuse overlay outside of admin pages, be it a core change or module that reuses the current API

TR’s picture

This is getting a little off-topic I think? The question is not whether we should be using Overlay as a general-purpose overlay, or whether Overlay should be modified to make that possible - that discussion belongs in the core issue queue.

The question is, should there be an example module in "Examples for Developers" that demonstrates something about how to use the Overlay.

Since the only way developers can "use" the Overlay are to create an admin page or alter the list of admin pages, the opportunities I see are:

1) Add an admin menu example in the menu_examples modules like rfay suggested in #1, to illustrate that any page under admin/* shows up in an overlay.
2) Add a new module to demonstrate how to implement common hooks, which could include hook_admin_paths() and hook_admin_paths_alter() as examples.

I don't see the first option as particularly useful for developers - it's more a demonstration of D7 capability. The second holds promise - implementing a hook is a basic technique that could use some examples, hook_form_alter() etc. Any takers to write this?

ilo’s picture

So, 2) 'Add a new module to demonstrate how to implement common hooks' as an admin overlay example module to developers does not show nothing special, and in my opinion such 'example' is not necessary. admin overlay API is quite small and easy to understand.

Probably this case is a good candidate for 'UX suggestions' as contextual links is: 'whenever you need an overlay, remember that core has one'. The extension of this Api usage fits well in a handbook page.

Welcome TR :)

Countzero’s picture

I respectfuly disagree with the previous comment.

A basic example of the Overlay API use would be extremely useful to me. As of now, I don't even know if using this API to display something else than the admin pages is possible.

Even a pointer to the source where the API is already implemented would be useful ; it would avoid me the hassle of going through the whole core sources understanding myself how the standard behaviour is achieved.

I think it would fit well in the "Examples for developers" module, but a handbook page would be a good start.

I say 'me' in this post, but if I stumble upon this you can be pretty sure others will, as I'm no special user, and that kind of UX features is more and more often asked by end users.

ilo’s picture

FileSize
1.58 KB

Countzero, a handbook page already exists: http://drupal.org/documentation/modules/overlay . Such a 'hasseling' as you said does not require so much work, searching for 'overlay api drupal' in google will point to the well linked-documented overlay module, that is a good implementation of itself, in fact, a regular drupal's self confined search will drop you with: http://drupal.org/project/admin_path

---
Small but effective module to configure which pages are to be considered administrative.

When a page is considered administrative the admin theme will be used. Also, when using the overlay module, administrative pages will open inside the overlay.
---

That said, here is the 'so much expected' overlay example for lazies, sorry, developers ;)

It is just a start (the .js files are missing), probably it could be improved by all those hordes of people awaiting for such an example like this.

Countzero’s picture

I don't see why you feel the need to be so agressive. The question in this thread was : would it be useful to propose an example for developers. I stated my opinion in a polite way, you'd be welcome to do the same.

It has nothing to do with lazyness : the whole purpose of the examples modules is to facilitate the life of coders who don't want to or don't have time to understand the full logic of some parts of Drupal. I think the present subject fits well in this scope. You may disagree, but there's no need to become contemptuous.

By the way, the man page you mention doesn't provide an implementation example and is only remotely related to the subject, and yes, I checked it before posting in this thread.

The example you provide is interesting and very informative, and will probably be useful. If it was so easy to implement, why bother arguing it's not being needed ?

---------

Back to the subject of this thread, I implemented the feature I needed with Colorbox, which works pretty well and is easy to implement, so maybe it's worth asking the question if core Overlay use outside admin areas is really the way to go ?

ilo’s picture

ohoo.. no hard feelings, I was just joking, and please, don't take it personal, nothing to do with that. In fact, as you have seen I took the time to write a module just because you asked.

The handbook I mentioned has two more links, in fact, there are three pages, one of them includes half of the code the I've included in the module.

Back to the topic, I dissagree (respectfully, of course) with your argument. The question for me is still the same: do we have to give 'administration' permissions to users just because of the overlay? even if they don't have access to the administration functionalities, the permission is still 'access administration pages using overlay', and in fact, the module I've uploaded includes some paths as 'admin paths', and they are not.. so, in the end, the final result of the overlay example is how to include a couple of paths in to the admin paths array. And now I'm not sure if this must go into an example, again.

ilo’s picture

Sorry, I forgot to mention the rationale behind my comment: Examples module provide guidelines, not just snippets. I mean, unless we are sure that this is the way to go, I'd not include a module as an example. This is the reason why this issue remains open since October. I'd not include anything that looks like 'works for me', or 'this is my use case code' implementation. In the meantime, a blog post about how to use overlay could do the trick for a lot of Drupal developers, and of course, I'm open to read and review other's code, if there is any, but unfortunatelly, nobody seems to consider it important enough to do, or perhaps they have found the same issue as I did?

rfay’s picture

A basic example of how to put a user registration form in an overlay would be nice. See this question in Drupal Answers.

Mile23’s picture

Issue summary: View changes
Status: Active » Postponed

Obviously some motion on this example would have been good, but Overlay is gone from Drupal 8, and the code in #14 would need quite a bit of review and work to be a proper Examples module.

So I'm marking this as postponed.

If anyone wants to work on it, go right ahead. Patches welcome.

Mile23’s picture

Category: Task » Feature request

This is really a feature request, which means it's postponed based on #2642596: D6, D7 Roadmap for Examples

If anyone wants to take it up, please do.

jungle’s picture

Status: Postponed » Closed (outdated)

No activity for over 7 years. I am closing this. Please feel free to reopen if necessary.

Thanks!