function regcode_og_settings in Registration codes 7
Same name and namespace in other branches
- 7.2 regcode_og/regcode_og.module \regcode_og_settings()
Form: Settings form for an og assignment rule.
9 string references to 'regcode_og_settings'
- regcode_og_create_submit in regcode_og/
regcode_og.module - Form submit: Create a new rule set.
- regcode_og_menu in regcode_og/
regcode_og.module - Implements hook_menu().
- regcode_og_name_exists in regcode_og/
regcode_og.module - Returns true if a rule with the given machine_name exists.
- regcode_og_regcode_used in regcode_og/
regcode_og.module - Implements hook_regcode_used().
- regcode_og_rules_page in regcode_og/
regcode_og.module - List all of the rules as a HTML table.
File
- regcode_og/
regcode_og.module, line 100 - Install, uninstall and scheme functions for the regcode_og module.
Code
function regcode_og_settings($form, &$form_state, $machine_name) {
$settings = variable_get('regcode_og_settings', array());
if (!isset($settings[$machine_name])) {
drupal_not_found();
}
$data = $settings[$machine_name];
// Retrieve labels for all groups.
$options = regcode_og_label(og_get_all_group());
// Store rule in form state.
$form_state['regcode_og_rule'] = $data;
$form['regcode_og_rule']['name'] = array(
'#type' => 'textfield',
'#title' => t('Rule name'),
'#required' => TRUE,
'#default_value' => $data['name'],
);
$form['regcode_og_rule']['ogs'] = array(
'#type' => 'checkboxes',
'#title' => t('Groups'),
'#description' => t('Assign user to this og group(s)'),
'#options' => $options,
'#default_value' => (array) $data['ogs'],
);
$form['regcode_og_rule']['tid'] = array(
'#type' => 'select',
'#title' => t('Tag'),
'#description' => t('When a user uses a regcode tagged with this term'),
'#options' => regcode_get_vocab_terms(),
'#default_value' => $data['tid'],
);
$form['regcode_og_save'] = array(
'#type' => 'submit',
'#value' => t('Save rule'),
);
$form['regcode_og_delete'] = array(
'#type' => 'submit',
'#value' => t('Delete rule'),
);
return $form;
}