function uc_recurring_subscription_action_grant_role_form in UC Recurring Payments and Subscriptions 6.2
Same name and namespace in other branches
- 7.2 modules/uc_recurring_subscription/uc_recurring_subscription.ca.inc \uc_recurring_subscription_action_grant_role_form()
Grant role CA form.
1 call to uc_recurring_subscription_action_grant_role_form()
- uc_recurring_subscription_action_revoke_role_form in modules/
uc_recurring_subscription/ uc_recurring_subscription.ca.inc - The revoke form is the same as the grant role form.
File
- modules/
uc_recurring_subscription/ uc_recurring_subscription.ca.inc, line 311
Code
function uc_recurring_subscription_action_grant_role_form($form_state, $settings = array()) {
drupal_add_css(drupal_get_path('module', 'uc_recurring_subscription') . '/uc_recurring_subscription.css');
$form['role_option'] = array(
'#type' => 'radios',
'#title' => t('Where are the role(s) defined?'),
'#attributes' => array(
'class' => 'ca-role-select-option',
),
'#options' => array(
'subscribe_grant' => t('Apply the roles set by the Subscription Manager on creation.'),
'expire_grant' => t('Apply the roles set by the Subscription Manager on expiration.'),
'expire_revoke' => t('Revoke the roles set by the Subscription Manager on expiration.'),
'custom' => t('Custom selected role (select from below)'),
),
'#default_value' => $settings['role_option'],
);
$roles = user_roles(TRUE);
unset($roles[DRUPAL_AUTHENTICATED_RID]);
if (empty($roles)) {
$form['role_error'] = array(
'#value' => t('There are no roles available to select. <a href="!url">Add a role</a>.', array(
'!url' => url('admin/user/roles'),
)),
);
}
else {
$form['role'] = array(
'#type' => 'checkboxes',
'#title' => t('Custom roles'),
'#attributes' => array(
'class' => 'ca-role-option',
),
'#options' => $roles,
'#default_value' => $settings['role'],
);
}
return $form;
}