You are here

function theme_twitter_account_list_form in Twitter 7.4

Same name and namespace in other branches
  1. 6.5 twitter.pages.inc \theme_twitter_account_list_form()
  2. 6.2 twitter.pages.inc \theme_twitter_account_list_form()
  3. 6.3 twitter.pages.inc \theme_twitter_account_list_form()
  4. 6.4 twitter.pages.inc \theme_twitter_account_list_form()
  5. 7.6 twitter.pages.inc \theme_twitter_account_list_form()
  6. 7.3 twitter.pages.inc \theme_twitter_account_list_form()
  7. 7.5 twitter.pages.inc \theme_twitter_account_list_form()

Themes the list of Twitter accounts.

File

./twitter.pages.inc, line 181
Page callbacks for Twitter module.

Code

function theme_twitter_account_list_form($variables) {
  $form = $variables['form'];
  if (variable_get('twitter_import', TRUE) && user_access('import own tweets')) {
    $header = array(
      '',
      t('Name'),
      t('Description'),
      t('Private'),
      t('Import'),
      t('Mentions'),
      t('Delete'),
    );
  }
  else {
    $header = array(
      '',
      t('Name'),
      t('Description'),
      t('Private'),
      t('Delete'),
    );
  }
  if (user_access('make twitter accounts global')) {
    $header[] = '';
  }
  $rows = array();
  foreach (element_children($form['accounts']) as $key) {
    $element =& $form['accounts'][$key];
    if (variable_get('twitter_import', TRUE) && user_access('import own tweets')) {
      $row = array(
        drupal_render($element['image']),
        drupal_render($element['id']) . drupal_render($element['screen_name']) . drupal_render($element['visible_name']),
        drupal_render($element['description']),
        drupal_render($element['protected']),
        drupal_render($element['import']),
        drupal_render($element['mentions']),
        drupal_render($element['delete']),
      );
    }
    else {
      $row = array(
        drupal_render($element['image']),
        drupal_render($element['id']) . drupal_render($element['screen_name']) . drupal_render($element['visible_name']),
        drupal_render($element['description']),
        drupal_render($element['protected']),
        drupal_render($element['delete']),
      );
    }
    if (user_access('make twitter accounts global')) {
      $label = $element['#account']->is_global ? t('remove global') : t('make global');
      $row[] = l($label, 'user/' . $element['#account']->uid . '/edit/twitter/global/' . $element['#account']->id);
    }
    $rows[] = $row;
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  return $output;
}