You are here

function user_badges_add_badge_action_form in User Badges 7.4

Same name and namespace in other branches
  1. 6.2 user_badges.module \user_badges_add_badge_action_form()
  2. 6 user_badges.module \user_badges_add_badge_action_form()
  3. 7 user_badges.actions.inc \user_badges_add_badge_action_form()
  4. 7.2 user_badges.actions.inc \user_badges_add_badge_action_form()
  5. 7.3 user_badges.actions.inc \user_badges_add_badge_action_form()

Add badge action form.

File

./user_badges.actions.inc, line 58
Actions for User Badges module.

Code

function user_badges_add_badge_action_form($context) {
  $form['badges'] = array(
    '#tree' => TRUE,
  );
  $badges = user_badges_get_badges('all');
  $context['badges'] = isset($context['badges']) ? $context['badges'] : array();
  foreach ($badges as $badge) {
    $form['badges'][$badge->bid] = array(
      '#type' => 'checkbox',
      '#title' => check_plain($badge->name),
      '#return_value' => 1,
      '#default_value' => isset($context['badges'][$badge->bid]) ? $context['badges'][$badge->bid] : FALSE,
    );
  }
  return $form;
}