0

Lets say for example we have activated contextual links & overlay modules and when clicking the edit button for the node, which is all the way bottom of the page, it open on overlay. Now when we look at the address bar the link now looks something like this http://localhost:8888/node#overlay=node/25/edit%3Fdestination%3Dnode

The problem with overlay is that it pushes the parent overlay to scroll all the way to the top and when I decide to "cancel" editing I have to scroll all the way to bottom again just to reach the node teaser. So I need to remove the this part from the link above #overlay=node/25/edit%3Fdestination%3Dnode

Now I guess it is being caused by jquery bbq feature. And looking into overlay module and her js files I find it very scary and dont know how to avoid this.

I need some help on where to look into this for starters like me.

2 Answers 2

0

kiamlaluno is correct. What you're asking for can't be done in Drupal 7 with the core overlay. However, HTML5's history features make it possible to implement exactly what you're asking for, and it's something we could do for Drupal 8. I think it could even be done in contrib for Drupal 7, if someone had the inclination.

Meanwhile, ctools is a good option, or the dialog module.

3

If you remove the "#overlay=node/25/edit%3Fdestination%3Dnode" part from the module, you disable the overlay for that page.

if that is what you want to do, then you need to implement hook_admin_paths_alter() in a module, using code similar to the following one (change "mymodule" with the effective short name of the module):

function mymodule_admin_paths_alter(&$paths) {
  $paths['node/*/edit'] = FALSE;
}

The result returned from hook_admin_paths() is used from the Overlay module to decide when a page is rendered in an overlay. The implementation of that hook done by the Node module is the following one:

function node_admin_paths() {
  if (variable_get('node_admin_theme')) {
    $paths = array(
      'node/*/edit' => TRUE, 
      'node/*/delete' => TRUE, 
      'node/*/revisions' => TRUE, 
      'node/*/revisions/*/revert' => TRUE, 
      'node/*/revisions/*/delete' => TRUE, 
      'node/add' => TRUE, 
      'node/add/*' => TRUE,
    );
    return $paths;
  }
}

The module that implements the hook I reported in the first code snippet should be enabled when the Overlay module is enabled; alternatively, that hook implementation should check if the Overlay module is enabled.

function mymodule_admin_paths_alter(&$paths) {
  if (module_exists("overlay")) {
    $paths['node/*/edit'] = FALSE;
  }
}

The information returned from hook_admin_paths() could be used from another module to render those pages in a different way, such as using an administrative theme; if the purpose is just to avoid the overlay is used to render that page, then the module should change the information returned by hook_admin_paths() only when the Overlay module is enabled.

3
  • Thanks for the response. Well, I dont want to disable overlay, I only want to hide the hashtag from the address bar. Everything in overlay must work as normal except that the url should look like this http://localhost:8888/node even when I am in the overlay mode. In other words my bbq should still be able to navigate back and forth. Its just that the url above wont change. I dont know if am able to make myself clear, but I am looking to tweak javascript inside overlay module, so that the url starting #overlay....... is hidden.
    – Minty
    Jul 27, 2011 at 18:55
  • As far as I can see, when the overlay is enabled, the "#overlay=" part is always present in the URL; when it is not present, then the overlay is not show. You cannot have a page shown in an overlay, and the URL shown in the browser bar without the "#overlay=" part.
    – apaderno
    Jul 27, 2011 at 18:58
  • You are correct, that is exactly how overlay is designed. Looks like I have to switch to ctools for this usecase. Thanks a lot.
    – Minty
    Jul 27, 2011 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.