function fb_autopost_entity_available_facebook_pages in Facebook Autopost 7
Returns the available options for the $page paramenter.
1 call to fb_autopost_entity_available_facebook_pages()
- available_facebook_destinations in fb_autopost_entity/
fb_autopost_entity.rules.inc - Returns the available destinations Pages + 'me'.
1 string reference to 'fb_autopost_entity_available_facebook_pages'
- fb_autopost_entity_rules_action_info in fb_autopost_entity/
fb_autopost_entity.rules.inc - Implements hook_rules_action_info().
File
- fb_autopost_entity/
fb_autopost_entity.rules.inc, line 138 - Rules integration.
Code
function fb_autopost_entity_available_facebook_pages() {
module_load_include('inc', 'fb_autopost', 'fb_autopost.admin');
$available = array_values(array_filter(variable_get('fb_autopost_page', array())));
try {
$fb = facebook_autopost();
$pages_data = $fb
->getPagesData(variable_get('fb_autopost_account_id', 'me'), variable_get('fb_autopost_token', ''));
$options = _fb_autopost_get_page_options($pages_data);
$output = array();
foreach ($options as $option => $label) {
if (in_array($option, $available)) {
$output[$option] = filter_xss($label);
}
}
return $output;
} catch (Exception $e) {
watchdog_exception('fb_autopost', $e);
drupal_set_message($e
->getMessage(), 'error');
}
}