function user_relationships_type_edit in User Relationships 5
Same name and namespace in other branches
- 5.2 user_relationships_forms.inc \user_relationships_type_edit()
Relationship type edit page.
2 string references to 'user_relationships_type_edit'
- user_relationships_menu in ./
user_relationships_hooks.inc - Menu
- user_relationship_implications_form_alter in plugins/
user_relationship_implications/ user_relationship_implications.module - hook_form_alter()
File
- ./
user_relationships_forms.inc, line 82
Code
function user_relationships_type_edit($rtid = NULL) {
if (is_numeric($rtid) && $rtid >= 0) {
$relationship_type = user_relationships_type_load(array(
'rtid' => $rtid,
));
}
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#maxlength' => 255,
'#default_value' => $relationship_type->name,
'#description' => t("Example: buddy, friend, coworker, spouse."),
'#required' => TRUE,
'#weight' => -10,
);
$form['plural_name'] = array(
'#type' => 'textfield',
'#title' => t('Plural name'),
'#maxlength' => 255,
'#default_value' => $relationship_type->plural_name,
'#description' => t("Example: buddies, friends, coworkers, spouses."),
'#weight' => -9,
);
$form['is_oneway'] = array(
'#type' => 'checkbox',
'#title' => t('This is a one-way relationship'),
'#default_value' => $relationship_type->is_oneway,
'#description' => t('Check this if this relationship should only go one way (ex Manager, Subscriber)'),
'#weight' => -8,
);
$form['requires_approval'] = array(
'#type' => 'checkbox',
'#title' => t('Requires Approval'),
'#default_value' => isset($relationship_type->requires_approval) ? $relationship_type->requires_approval : 1,
'#description' => t('Check this if the requestee must approve the relationship'),
'#weight' => -8,
);
$form['expires_val'] = array(
'#title' => t('Request expires in'),
'#field_suffix' => t('days'),
'#type' => 'textfield',
'#size' => 4,
'#default_value' => isset($relationship_type->expires_val) ? $relationship_type->expires_val : 0,
'#description' => t('After how many days should a request of this type be removed? (0 for never)'),
'#weight' => -8,
);
$form['rtid'] = array(
'#type' => 'value',
'#value' => $rtid,
);
$form['action'] = array(
'#type' => 'value',
'#value' => $relationship_type ? 'edit' : 'add',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#weight' => 10,
);
return $form;
}