Hi there,

I can't seem to find any documentation on hook_fb, am I missing something, or isn't there any?
I would like to know what kind of operations are supported.

Any help would be greatly appreciated, thans in advance!

CommentFileSizeAuthor
#2 fb modules which implement hook_fb154.42 KBJakob Stoeck

Comments

Dave Cohen’s picture

Category: support » task

There isn't any at the moment, but admiittedly it needs doing. We're working on the documentation pages at the moment.

For now, the code is its own best documentation. You can browse that at http://www.drupalforfacebook.org/dox/6.x-3.x-dev/, although there's no easy way to search which modules implement hook_fb there.

Jakob Stoeck’s picture

StatusFileSize
new154.42 KB

A regex search over the fb modules led to what I think are all implementations of that hook (unfortunately could not copy, that's why it's an image)

Dave Cohen’s picture

here's some very preliminary doc, and some debug code that may help you figure out when the hook is called and what it is passed.
This doesn't document nearly all the $ops. Most are used internally within modules/fb, your custom code would need those only if you wanted to replace completely those modules. One of my design goals is to reduce dependencies within modules/fb by having modules communicate via this hook.



/**                                                                                                              
 * Implements hook_fb().                                                                                         
 *                                                                                                               
 * This hook provides an opportunity to customize the behavior of Facebook Applications.                         
 *                                                                                                               
 * @param $op                                                                                                    
 *   Indicates what operation is currently being performed, or which behavior                                    
 *   can be customized.  There are a number of these.  In some cases,                                            
 *   modules/fb is informing other modules, and in other operations it is                                        
 *   asking for information.                                                                                     
 *   - FB_OP_INITIALIZE - The facebook sdk has been initialized.  This tells a                                   
 *     facebook application is enable for the current request.                                                   
 *   - FB_OP_PRE_USER - You have a chance to the name or other account                                           
 *     attributes, before a new user account is created.                                                         
 *   - FB_OP_POST_USER - A new user account was created for a facebook use who authorized an app.                
 *   - FB_OP_APP_IS_AUTHORIZED - The visitor to this page has authorized the application.                        
 *                                                                                                               
 * @param $data                                                                                                  
 *   Associative array of information specific to this operation. Usually, but not always, contains:             
 *   - 'fb' - The API provided by the facebook-php-sdk.                                                          
 *   - 'fb_app' - The data about this application stored by fb_app.module.                                       
 *   - 'fbu' - If the current user is known, their facebook id.                                                  
 *                                                                                                               
 * @param $return                                                                                                
 *   An op-specific return value.  Your hook should change this reference                                        
 *   variable, and not return it.  Some operations return an array of data,                                      
 *   which may be collaboratively built by multiple implementations of this                                      
 *   hook.                                                                                                       
 *                                                                                                               
 *   @TODO - this documentation is very incomplete!                                                              
 */
function fb_example_fb($op, $data, &$return) {
  $fb_app = isset($data['fb_app']) ? $data['fb_app'] : NULL;
  $fb = isset($data['fb']) ? $data['fb'] : NULL;

  // Use devel module to help figure out how this hook is called.                                                
  dpm($data, "fb_example_fb($op) called");
}

Dave Cohen’s picture

Issue tags: +fb3-blocker

marking this as a todo for 3.0 release