Dear Jacob,

First I'd like you to congratulat for this great module. It is very useful for my project.

I'd like to suggest a possibility of rewiting the $current_path variable in the fieldset_helper_state_manager_get_lookup_id() function. There are some pages, which is similar in respect of the layout, only the content is different. One such page is a search result. If I use facets, and I open/close some facet as user, I would like to keep them open/close in the next search as well. The search URLs typically build as the following: [a stable part]/[query term]. The module always use $_GET['q'] as the key for the path, and with my suggestion it would be possible to forget the [query term] part, and using the [stable part] as the key for the state.

so instead of this current code:

  $current_path = $_GET['q'];

I suggest this addition:

  $current_path = $_GET['q'];
  $param =& new stdClass();
  $param->current_path = $current_path;
  module_invoke_all('fieldset_helper_rewite_path', $param);
  $current_path = $param->current_path;

The $param is a reference, and the implementors of the hook could modify the $param->current_path.

I created an implementation for my own need:

function xc_search_fieldset_helper_rewite_path(&$param) {
  $param->current_path = preg_replace('/^(search\/xc_search)\/.*$/', "$1", $param->current_path);
  return TRUE;
}

Hope this suggestion could be useful for others.

Péter

Comments

pkiraly’s picture

StatusFileSize
new974 bytes

I created a patch for this suggestion to make it easy to try.

pkiraly’s picture

Status: Active » Needs review
jrockowitz’s picture

pkiraly,

I am really sorry for not having time to implement this patch. I am completely slammed right now.

Personally I am seeing a lot of issues with my module.
- The 'fieldset_helper_auto_exclude variable' is getting huge for a large site.
- I would like to figure out a way to save the state of the same fieldset across multiple pages.

The good news is my PHP and Drupal skills are quickly improving and when I have time to start the next version of this module I will add in a few helpful hooks.

thanks
~jake

jrockowitz’s picture

pkiraly,

Thank you posting this issue. While working on the fieldset helper 6.x-2.x branch, I added your hook as HOOK_fieldset_helper_path_alter(&$path).

I also added the ability to specify global fieldsets by path and/or #id (with wildcard support), which can also help solve your problem.

Thanks,
~jake

pkiraly’s picture

I updated my previous patch, and borrowed the appropriate lines from 6.x-2.x branch. This way, the hook implementations will be maintainable in the future.

jrockowitz’s picture

Status: Needs review » Closed (fixed)

Changes have been applied and releases in 6.x-2.0