Needs review
Project:
OG Panels
Version:
6.x-2.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Apr 2010 at 14:25 UTC
Updated:
7 Apr 2010 at 03:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
jimthunderbird commentedHi Baff,
Could you export your views so I can test it?
Thanks.
Best Regards,
Jim
Comment #2
jimthunderbird commentedHi Baff,
I have figured out what happened. Basically after you submit the views exposed form, the form's action is / which leads to urls like:
/?nid_op=%3D&nid[value]=1&nid[min]=&nid[max]=
This type of url will cause the tab to loose effects, we need something like /node/1?nid_op=%3D&nid[value]=1&nid[min]=&nid[max]=
The following is a hook_form_alter type fix to it.
Best Regards,
Jim
Comment #3
baff commentedHallo jimthunderbird, wow you are fast!
Should I put function og_panels_form_alter into og_panels.module until a new version is there?
PS: You don't need my exported view anymore as you found out already?
Comment #4
baff commentedI have made the patch like that in og_panels.module:
/**
* Implementation of hook_form_alter
* attach og_panels_export_import_form before the panel edit form
*/
function og_panels_form_alter(&$form, $form_state, $form_id){
if($form_id == 'panels_edit_display_form' && arg(0) == 'node' && arg(1) > 0 && arg(2) == 'og_panels' && arg(3) > 0){
if(user_access('import and export OG panels pages')){
$did = (int)arg(3);
$form['#prefix'] = drupal_get_form('og_panels_export_import_form', $did);
}
}
/**
* patch
*/
if($form_id == 'views_exposed_form'){
if(arg(0) == 'node' && arg(1) > 0){
$form['#action'] = url("node/".arg(1));
}
}
/**
* patch ende
*/
}
The rsult is: I can sse my view with exposed filters and tabs. When executing the filter I come to the group homepage, but not the result of my view.
My view attached, very simple one - just for testing
Comment #5
jimthunderbird commentedHi baff,
Thanks for posting the view. Honestly, When using views exposed filter in og panels page, as you observed, though the tabs and filter form works, the result will not be displayed. I was thinking about a possible solution here, but it's more of a "developer oriented" solution.
If you analyse the url that's generated when you post the views exposed filter form, it will have some request variables like type=***, with that, you can create a new custom content in your og panels page, inside you can use views_get_view function in views module and pass the arguments in.
So in the body of your new custom content, you can use php as input filter, then call views_get_view with your views name, then pass the arguments from the url as the arguments to the view.
For your reference, there is a post talking about how to embed a view here:
http://drupal.org/node/246742
It boiled down to using 2 apis:
$view = views_get_view($name);
print $view->preview($display_id, $args);
Using views_embed_view api will be good enough.
Here's a link on how to use it:
http://www.wootenswebdesign.com/viewsembedview-usage
Also, my previous patch does not cover this use case:
If you put your exposed filter on other og panels except the homepage one, my previous form alter solution is not good enough, here is a solution covering this case:
Hope this helps.
Best Regards,
Jim
Comment #6
jimthunderbird commentedA quick update:
I've make the exposed filter work, I will describe the process and hope it gave you some hints:
1. I first modify og_panels module, as mentioned before, using hook_form_alter
2. I created 4 content types in my testing drupal site, "community", "community_post", "story", "page"
3. I created a view named "dummy_node_type_filter", use Node:type as argument and then exposed the node type and make the filtering form display as a block.
4. I then create a new og panels page, place the exposed filtering form in it.
5. I then created a new custom content underneath the exploded filter form, inside I put the following php code
Basically what it does is look for the type variable in the request variables and then pass it to my view.
Save all the works and now it works great.
Hope this help on your way of site development.
Best Regards,
Jim
Comment #7
jimthunderbird commentedCommited!