You are here

function theme_flag_actions_page in Flag 5

Same name and namespace in other branches
  1. 6.2 flag_actions.module \theme_flag_actions_page()
  2. 6 flag_actions.module \theme_flag_actions_page()
  3. 7.3 flag_actions.module \theme_flag_actions_page()
  4. 7.2 flag_actions.module \theme_flag_actions_page()

Theme the list of actions currently in place for flags.

1 theme call to theme_flag_actions_page()
flag_actions_page in ./flag_actions.module
Menu callback for admin/build/flags/actions.

File

./flag_actions.module, line 222
Actions support for the Flag module.

Code

function theme_flag_actions_page($actions, $add_action_form) {
  $rows = array();
  foreach ($actions as $action) {
    $flag = flag_get_flag($action->flag);
    $row = array();
    $row[] = $flag
      ->get_title();
    $row[] = ($action->event == 'flag' ? '≥ ' : '< ') . $action->threshold;
    $row[] = empty($action->missing) ? $action->description : '<div class="error">' . $action->description . '</div>';
    $row[] = l(t('edit'), 'admin/build/flags/actions/configure/' . $action->aid);
    $row[] = l(t('delete'), 'admin/build/flags/actions/delete/' . $action->aid);
    $rows[] = $row;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('Currently no flag actions. Use the <em>Add new flag action</em> form to add an action.'),
        'colspan' => 6,
      ),
    );
  }
  $header = array(
    t('Flag'),
    t('Threshold'),
    t('Action'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $output = '';
  $output .= theme('table', $header, $rows);
  $output .= $add_action_form;
  return $output;
}