You are here

function _fb_autopost_get_page_options in Facebook Autopost 7

Helper function to get all the available pages.

Parameters

array $pages_data: An array containig the Facebook information about the page as returned from FBAutopost::getPagesData(…).

Return value

array Array containing an options friendly array with all writable pages

2 calls to _fb_autopost_get_page_options()
fb_autopost_entity_available_facebook_pages in fb_autopost_entity/fb_autopost_entity.rules.inc
Returns the available options for the $page paramenter.
fb_autopost_global_settings in ./fb_autopost.admin.inc
FAPI system admin form.

File

./fb_autopost.admin.inc, line 128
Admin forms.

Code

function _fb_autopost_get_page_options($pages_data) {
  $output = array();
  $data = array_filter($pages_data['data'], function ($item) {
    return $item['category'] != 'Application' && in_array('CREATE_CONTENT', $item['perms']);
  });
  foreach ($data as $value) {
    $output[$value['id']] = theme('fb_autopost_facebook_page', array(
      'name' => $value['name'],
      'id' => $value['id'],
      'category' => $value['category'],
    ));
  }
  return $output;
}