You are here

function hosting_feature_role_perms_table in Hosting 7.4

Same name and namespace in other branches
  1. 7.3 hosting.features.inc \hosting_feature_role_perms_table()

Helper function to list Hosting feature permissions.

1 string reference to 'hosting_feature_role_perms_table'
hosting_features_form in ./hosting.features.inc
The Hosting features form.

File

./hosting.features.inc, line 371
Include for functionality related to Hosting module features.

Code

function hosting_feature_role_perms_table($form, &$form_table, $role_perms) {
  $form = array();
  $form['role_perms'] = array(
    '#type' => 'fieldset',
    '#title' => 'Roles & permissions',
    '#description' => 'Upon enabling this feature, the following roles will be assigned the listed permissions.',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $table = '<table><thead><tr><th>Role</th><th>Permissions</th></tr></thead><tbody>';
  foreach ($role_perms as $role => $perms) {
    $table .= '<tr><td>' . $role . '</td>';
    $table .= '<td>' . implode(', ', $perms) . '</td></tr>';
  }
  $table .= '</tbody></table>';
  $form['role_perms']['table'] = array(
    '#markup' => $table,
  );
  return $form;
}