You are here

function block_access_fieldset in Block Access 7

Same name and namespace in other branches
  1. 6.2 block_access.module \block_access_fieldset()
  2. 6 block_access.module \block_access_fieldset()
2 calls to block_access_fieldset()
block_access_form_alter in ./block_access.module
block_access_module_form in ./block_access.admin.inc

File

./block_access.module, line 523

Code

function block_access_fieldset(&$form, $role_options, $perm, $module, $delta = NULL, $realname = NULL) {
  if ($realname === NULL) {
    $realname = t('Role specific @perm settings', array(
      '@perm' => $perm,
    ));
  }
  else {
    $realname = t('@realname', array(
      '@realname' => $realname,
    ));
  }
  module_load_include('inc', 'block_access', 'block_access.db');
  $default_role_options = block_access_get_roles($module, $perm, $delta);
  $collapsed = empty($default_role_options) ? TRUE : FALSE;
  $form['role_' . $perm . '_settings'] = array(
    '#type' => 'fieldset',
    '#title' => $realname,
    '#collapsible' => TRUE,
    '#collapsed' => $collapsed,
  );
  $form['role_' . $perm . '_settings'][$perm . '_roles'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Set permission for specific roles'),
    '#default_value' => $default_role_options,
    '#options' => $role_options,
    '#description' => t('Set this permission for the selected role(s). If no roles are set the option will be available to all. '),
  );
}