You are here

function flag_add_form in Flag 7.3

Same name and namespace in other branches
  1. 5 includes/flag.admin.inc \flag_add_form()
  2. 6.2 includes/flag.admin.inc \flag_add_form()
  3. 6 includes/flag.admin.inc \flag_add_form()
  4. 7.2 includes/flag.admin.inc \flag_add_form()

Present a form for creating a new flag, setting the type of flag.

1 string reference to 'flag_add_form'
flag_add_page in includes/flag.admin.inc
Menu callback for adding a new flag.

File

includes/flag.admin.inc, line 260
Contains administrative pages for creating, editing, and deleting flags.

Code

function flag_add_form($form, &$form_state) {
  $types = array();
  foreach (flag_fetch_definition() as $type => $info) {
    $types[$type] = $info['title'] . '<div class="description">' . $info['description'] . '</div>';
  }
  $form['type'] = array(
    '#type' => 'radios',
    '#title' => t('Flag type'),
    '#default_value' => 'node',
    '#description' => t('The type of object this flag will affect. This cannot be changed once the flag is created.'),
    '#required' => TRUE,
    '#options' => $types,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Continue'),
  );
  return $form;
}