function flag_add_form in Flag 6.2
Same name and namespace in other branches
- 5 includes/flag.admin.inc \flag_add_form()
- 6 includes/flag.admin.inc \flag_add_form()
- 7.3 includes/flag.admin.inc \flag_add_form()
- 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 213 - Contains administrative pages for creating, editing, and deleting flags.
Code
function flag_add_form(&$form_state) {
$form = array();
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Flag name'),
'#description' => t('The machine-name for this flag. It may be up to 32 characters long and may only contain lowercase letters, underscores, and numbers. It will be used in URLs and in all API calls.'),
'#maxlength' => 32,
'#required' => TRUE,
);
$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 content this flag will affect. An individual flag can only affect one type of content. This cannot be changed once the flag is created.'),
'#required' => TRUE,
'#options' => $types,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add flag'),
);
return $form;
}