function regcode_og_create in Registration codes 7
Same name and namespace in other branches
- 7.2 regcode_og/regcode_og.module \regcode_og_create()
Form: Create form for og assignment rules.
1 string reference to 'regcode_og_create'
- regcode_og_menu in regcode_og/
regcode_og.module - Implements hook_menu().
File
- regcode_og/
regcode_og.module, line 174 - Install, uninstall and scheme functions for the regcode_og module.
Code
function regcode_og_create($form, &$form_state) {
// Retrieve labels for all groups.
$options = regcode_og_label(og_get_all_group());
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Rule name'),
'#maxlength' => 255,
'#description' => t('Name this rule for administration purposes.'),
'#required' => TRUE,
);
$form['machine_name'] = array(
'#type' => 'machine_name',
'#title' => t('Machine name'),
'#maxlength' => 21,
'#description' => t('A unique name to construct the URL for this rule. It must only contain lowercase letters, numbers and hyphens.'),
'#machine_name' => array(
'exists' => 'regcode_og_name_exists',
),
);
$form['ogs'] = array(
'#type' => 'checkboxes',
'#title' => t('Groups'),
'#options' => $options,
'#description' => t('Assign user to this og group(s)'),
'#required' => TRUE,
);
$form['tid'] = array(
'#type' => 'select',
'#title' => t('Tag'),
'#description' => t('When a user uses a regcode tagged with this term'),
'#options' => regcode_get_vocab_terms(),
);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Create rule'),
);
return $form;
}