function user_relationships_ui_type_edit in User Relationships 6
Relationship type edit page.
1 string reference to 'user_relationships_ui_type_edit'
- user_relationships_ui_menu in user_relationships_ui/
user_relationships_ui.module - Implementation of hook_menu().
File
- user_relationships_ui/
user_relationships_ui.admin.inc, line 185
Code
function user_relationships_ui_type_edit(&$form_state, $relationship_type = NULL) {
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#maxlength' => 255,
'#default_value' => isset($relationship_type) ? $relationship_type->name : NULL,
'#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' => isset($relationship_type) ? $relationship_type->plural_name : NULL,
'#description' => t("Example: buddies, friends, coworkers, spouses."),
'#weight' => -9,
);
$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' => -7,
);
$form['is_oneway'] = array(
'#type' => 'checkbox',
'#title' => t('This is a one-way relationship'),
'#default_value' => isset($relationship_type) ? $relationship_type->is_oneway : NULL,
'#description' => t('Check this if this relationship should only go one way (ex Manager, Subscriber)'),
'#weight' => -6,
);
$form['is_reciprocal'] = array(
'#type' => 'checkbox',
'#title' => t('This one-way relationship can be reciprocated'),
'#default_value' => isset($relationship_type) ? $relationship_type->is_reciprocal : NULL,
'#description' => t('Check if this one-way relationship can go either way'),
'#weight' => -5,
);
$form['roles'] = array(
'#title' => t('Role request access'),
'#type' => 'fieldset',
'#description' => t('You may choose which roles are allowed to request this relationship. If none are selected, all roles are allowed.'),
'roles' => array(
'#type' => 'checkboxes',
'#options' => user_roles(TRUE),
'#default_value' => isset($relationship_type->roles) ? $relationship_type->roles : array(),
),
);
$form['roles_receive'] = array(
'#title' => t('Role receive access'),
'#type' => 'fieldset',
'#description' => t('You may choose which roles are allowed to receive this relationship. If none are selected, all roles are allowed to receive the relationship.'),
'roles_receive' => array(
'#type' => 'checkboxes',
'#options' => user_roles(TRUE),
'#default_value' => isset($relationship_type->roles_receive) && is_array($relationship_type->roles_receive) ? $relationship_type->roles_receive : array(),
),
);
$form['rtid'] = array(
'#type' => 'value',
'#value' => isset($relationship_type) ? (int) $relationship_type->rtid : NULL,
);
$form['action'] = array(
'#type' => 'value',
'#value' => $relationship_type ? 'edit' : 'add',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#weight' => 10,
);
return $form;
}