You are here

function fb_admin_app_info in Drupal for Facebook 7.4

Display detailed information about an application.

TODO: make this is theme function.

1 call to fb_admin_app_info()
fb_connect_admin_form in ./fb_connect.admin.inc
Form callback.

File

./fb.admin.inc, line 101

Code

function fb_admin_app_info($app) {
  $markup = array(
    '#type' => 'markup',
    '#prefix' => '<p>',
    '#suffix' => '</p>',
  );
  if (!$app) {
    return array(
      '#markup' => t('There is no application configured.'),
    ) + $markup;
  }
  try {

    // TODO: determine whether app token is known.
    // TODO: FQL queries if necessary for more data
    $app = fb_graph($app['client_id']);
    $args = array(
      '!app' => l($app['name'], $app['link']),
    );

    // Args to t() need a ! in front.
    foreach ($app as $key => $value) {
      if (!is_array($value)) {
        $args['!' . $key] = $value;
      }
    }
    $output[] = array(
      '#markup' => '<img src="' . $app['logo_url'] . '"/>',
    ) + $markup;
    $output[] = array(
      '#markup' => t('Using application !app.', $args),
    ) + $markup;
  } catch (exception $e) {
    fb_log_exception($e, t('Failed to query application data.'));
    $output[] = array(
      '#markup' => t('Could not find the application %name (%client_id) !', array(
        '%name' => $app['name'],
        '%client_id' => $app['client_id'],
      )),
    ) + $markup;
  }
  return $output;
}