function theme_password_policy_admin_list in Password Policy 7
Same name and namespace in other branches
- 6 password_policy.theme.inc \theme_password_policy_admin_list()
Returns HTML for the password policy administration list.
Parameters
array $variables: An associative array containing:
- form: A render element representing the form.
See also
File
- ./
password_policy.admin.inc, line 277 - Admin page callback file for the Password Policy module.
Code
function theme_password_policy_admin_list(array $variables) {
$form = $variables['form'];
$rows = array();
if (isset($form['policies']) && count($form['policies'])) {
foreach (element_children($form['policies']) as $id) {
$form['policies'][$id]['weight']['#attributes']['class'] = array(
'password-policy-order-weight',
);
$rows[] = array(
'data' => array(
drupal_render($form['policies'][$id]['name']),
drupal_render($form['policies'][$id]['roles']),
drupal_render($form['policies'][$id]['enabled']),
drupal_render($form['policies'][$id]['weight']),
drupal_render($form['policies'][$id]['view']),
drupal_render($form['policies'][$id]['edit']),
drupal_render($form['policies'][$id]['delete']),
),
'class' => array(
'draggable',
),
);
}
}
if (empty($rows)) {
unset($form['actions']['submit']);
}
$header = array(
t('Name'),
t('Roles'),
t('Enabled'),
t('Weight'),
array(
'data' => t('Operations'),
'colspan' => 3,
),
);
$output = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'password-policy-order',
),
'empty' => t('There are currently no policies. <a href="!url">Add a new one</a>.', array(
'!url' => url('admin/config/people/password_policy/add'),
)),
));
$output .= drupal_render_children($form);
drupal_add_tabledrag('password-policy-order', 'order', 'sibling', 'password-policy-order-weight');
return $output;
}