You are here

function flag_actions_add_form in Flag 6

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

Modified version of the Add action form that redirects back to the flag list.

1 string reference to 'flag_actions_add_form'
flag_actions_page in ./flag_actions.module
Menu callback for admin/build/flags/actions.

File

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

Code

function flag_actions_add_form($form_state) {
  $flags = flag_get_flags();
  $options = array();
  foreach ($flags as $flag) {
    $options[$flag->name] = $flag
      ->get_title();
  }
  if (empty($options)) {
    $options[] = t('No flag available');
  }
  $form = array();
  $form['flag'] = array(
    '#type' => 'select',
    '#options' => empty($options) ? array(
      t('No flag available'),
    ) : $options,
    '#disabled' => empty($options),
    '#title' => t('Select a flag'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add action'),
  );
  return $form;
}