function example_convert_geofield in Facebook OAuth (FBOAuth) 7
Same name and namespace in other branches
- 7.2 fboauth.api.php \example_convert_geofield()
Example callback for conversion of Facebook location property to a Geofield.
For more callback examples, check the list in fboauth_field_convert_info().
Parameters
$facebook_property_name: The name of the property being converted from Facebook's structure into a Drupal data structure.
$fbuser: An object representing the Facebook user. Typically the property to be converted will be at $fbuser->$facebook_property_name.
$field: The Field module field configuration array.
$instance: The Field module field instance configuration array.
1 string reference to 'example_convert_geofield'
- hook_fboauth_field_convert_info_alter in ./
fboauth.api.php - Alter the list of Field API field types that are supported as targets.
File
- ./
fboauth.api.php, line 167 - This file contains API documentation for the Facebook OAuth module. Note that all of this code is merely for example purposes, it is never executed when using the Facebook OAuth module.
Code
function example_convert_geofield($facebook_property_name, $fbuser, $field, $instance) {
if (!empty($fbuser->{$facebook_property_name})) {
// Perform conversion from Facebook's location information to geo info.
// Conversion code here...
return array(
'lat' => $lat,
'lon' => $long,
);
}
return NULL;
}