Just a thought about integrating Commons and Facebook pages. I have just spend too much time integrating with /project/fb (Drupal for Facebook) and most of it is relatively easy to puzzle out, but one stubbling block is that for Facebook you need a second theme that is 760px wide; assuming the main theme is different. Doing with this Context is a bit daunting.
I am looking at a global hack, but the direct method would be to create a custom condition that toggles for Facebook and duplicate all of the context sections using the new condition. (The hack would be to switch all the context sections using a naming convention, like appending _fb on all context names based on the function call.
The point is that we are all playing catch up to Facebook. I predict that many of your Commons clients will have Facebook pages integration as a requirement. Context appears to me to be a bit of an issue.
This will not be of interest to most people. I have a need to have an alternate theme for Facebook canvus pages. I had two problems. One is that for Facebook the theme should be 760px wide, and my theme is wider, and the second problem is with Context which is managing blocks and does not support multiple themes like Drupal core does.
My solution is with /project/fb (Drupal for Facebook)
The Facebook page is here
http://apps.facebook.com/referendum_com
I will do the remaining context adjustments in the next few days, and work on the voting javascript (hopefully).
fb has a function call fb_is_canvas()
and a hook when it loads all the context
I cloned all my context with an alternate with the suffix "-fb".
For exampe, the clone for
context_ui-home-homepage
is
context_ui-home-homepage-fb
The global clone, context_ui-global-global-fb, has a "theme" reaction to set "section class" to include "fb-canvas" in the classes.
This is used to override many CSS statements at the bottom of local.css (Fusion based theme).
/**
* hook_context_load
* switch between context based on name suffix "-fb"
*/
function referendum_custom_context_load_alter(&$vars) {
if (module_exists('fb_canvas') && fb_is_canvas()) {
// facebook canvas
if (!strpos($vars->name,'-fb')) {
$vars->name = false;
}
} else {
// not facebook
if (strpos($vars->name,'-fb')) {
$vars->name = false;
}
}
}
I use this for easyier development of the alternate theme, without going through Facebook. It forces the alternate theme when logged in as admin (uid=1)
so mine actually looks like this and I cripple the uid condition when not working on the theme
1
2
3
4
function referendum_custom_context_load_alter(&$vars) {
global $user;
//dsm($user->uid);
if (($user->uid == 1) || (module_exists('fb_canvas') && fb_is_canvas())) {
Comments
Do you have any experience
Do you have any experience with Drupal outside of Drupal Commons?
There are thousands of additional modules that you can add to achieve all the functionality you want.
You can try Invite for inviting people.
You can try Twitter, Facebook auth, Facebook connect, or OpenID for external authentication.
You can try Share This, or AddtoAny for sharing links on social sites.
Try going to Drupal.org and searching for these.
I'm not sure what your Drupal experience is so I don't want to provide basic instructions that you might already know. Let me know..
Facebook canvas issues
Hi Mike,
Just a thought about integrating Commons and Facebook pages. I have just spend too much time integrating with /project/fb (Drupal for Facebook) and most of it is relatively easy to puzzle out, but one stubbling block is that for Facebook you need a second theme that is 760px wide; assuming the main theme is different. Doing with this Context is a bit daunting.
I am looking at a global hack, but the direct method would be to create a custom condition that toggles for Facebook and duplicate all of the context sections using the new condition. (The hack would be to switch all the context sections using a naming convention, like appending _fb on all context names based on the function call.
The point is that we are all playing catch up to Facebook. I predict that many of your Commons clients will have Facebook pages integration as a requirement. Context appears to me to be a bit of an issue.
Jerry
alternate theme with context
This will not be of interest to most people. I have a need to have an alternate theme for Facebook canvus pages. I had two problems. One is that for Facebook the theme should be 760px wide, and my theme is wider, and the second problem is with Context which is managing blocks and does not support multiple themes like Drupal core does.
My solution is with /project/fb (Drupal for Facebook)
The Facebook page is here
http://apps.facebook.com/referendum_com
I will do the remaining context adjustments in the next few days, and work on the voting javascript (hopefully).
fb has a function call fb_is_canvas()
and a hook when it loads all the context
I cloned all my context with an alternate with the suffix "-fb".
For exampe, the clone for
context_ui-home-homepage
is
context_ui-home-homepage-fb
The global clone, context_ui-global-global-fb, has a "theme" reaction to set "section class" to include "fb-canvas" in the classes.
This is used to override many CSS statements at the bottom of local.css (Fusion based theme).
For example:
body.fb-canvas, .fb-canvas div.full-width { min-width: 760px; } .fb-canvas .grid16-16 { width: 760px; } .fb-canvas .grid16-12 { width: 520px; } .fb-canvas #block-search-0 { clear: left; width: 320px; }and many more...
/** * hook_context_load * switch between context based on name suffix "-fb" */ function referendum_custom_context_load_alter(&$vars) { if (module_exists('fb_canvas') && fb_is_canvas()) { // facebook canvas if (!strpos($vars->name,'-fb')) { $vars->name = false; } } else { // not facebook if (strpos($vars->name,'-fb')) { $vars->name = false; } } }I use this for easyier development of the alternate theme, without going through Facebook. It forces the alternate theme when logged in as admin (uid=1)
so mine actually looks like this and I cripple the uid condition when not working on the theme
function referendum_custom_context_load_alter(&$vars) { global $user; //dsm($user->uid); if (($user->uid == 1) || (module_exists('fb_canvas') && fb_is_canvas())) {