You are here

function block_access_check_config_form in Block Access 7

Same name and namespace in other branches
  1. 6.2 block_access.module \block_access_check_config_form()
  2. 6 block_access.module \block_access_check_config_form()
1 call to block_access_check_config_form()
block_access_form_alter in ./block_access.module

File

./block_access.module, line 424

Code

function block_access_check_config_form(&$form) {
  $module = $form['module']['#value'];
  $delta = $form['delta']['#value'];
  if (!block_access_can_config_lang($module, $delta)) {
    unset($form['i18n']);
  }
  if (!block_access_can_config_title($module, $delta)) {
    $form['settings']['title']['#access'] = FALSE;
  }
  if (!block_access_can_config_description($module, $delta)) {
    $form['settings']['info']['#access'] = FALSE;
  }
  if (!block_access_can_config_body($module, $delta)) {
    $form['settings']['body_field']['#access'] = FALSE;
  }
  if (!block_access_can_config_region($module, $delta)) {
    $form['regions']['#access'] = FALSE;
  }
  else {
    block_access_set_allowable_regions_config($module, $delta, $form);
  }
  if (!block_access_can_config_page($module, $delta)) {
    $form['visibility']['path']['#access'] = FALSE;
  }
  if (!block_access_can_config_role($module, $delta)) {
    $form['visibility']['role']['#access'] = FALSE;
  }
  if (!block_access_can_config_user($module, $delta)) {
    $form['visibility']['user']['#access'] = FALSE;
  }
  if (module_exists('node') && !block_access_can_config_type($module, $delta)) {
    $form['visibility']['node_type']['#access'] = FALSE;
  }

  // Hide the Visibility settings title if there are none available
  if (!block_access_can_config_page($module, $delta) && !block_access_can_config_role($module, $delta) && !block_access_can_config_user($module, $delta) && (module_exists('node') && !block_access_can_config_type($module, $delta))) {
    $form['visibility_title']['#access'] = FALSE;
  }
}