diff --git a/workbench_access.admin.inc b/workbench_access.admin.inc index c69c2c6..730c3ff 100644 --- a/workbench_access.admin.inc +++ b/workbench_access.admin.inc @@ -16,26 +16,27 @@ function workbench_access_settings_form($form, &$form_state) { foreach ($info as $key => $value) { $options[$key] = $value['name'] . '
' . $value['description'] . '
'; } - $active = variable_get('workbench_access'); - $form = array(); - $form['help'] = array( - '#markup' => '

' . t('Workbench Access settings') . '

', - ); - // Check for proper installation. - if (module_exists('taxonomy')) { - $vocabulary = workbench_access_sample_vocabulary(); - $exists = workbench_access_vocabulary_exists($vocabulary); - if (!$exists && (empty($active) || $active == 'taxonomy')) { - $form['help']['#markup'] .= '

' . t('Install the test configuration for Workbench.', array('!url' => url('admin/config/workbench/access/install'))) .'

'; + if (!empty($options)) { + $active = variable_get('workbench_access'); + $form = array(); + $form['help'] = array( + '#markup' => '

' . t('Workbench Access settings') . '

', + ); + // Check for proper installation. + if (module_exists('taxonomy')) { + $vocabulary = workbench_access_sample_vocabulary(); + $exists = workbench_access_vocabulary_exists($vocabulary); + if (!$exists && (empty($active) || $active == 'taxonomy')) { + $form['help']['#markup'] .= '

' . t('Install the test configuration for Workbench.', array('!url' => url('admin/config/workbench/access/install'))) .'

'; + } } - } - $form['workbench_access'] = array( - '#type' => 'radios', - '#title' => t('Active access scheme'), - '#options' => $options, - '#description' => t('Select the access scheme to use for the site.'), - '#required' => TRUE, - ); + $form['workbench_access'] = array( + '#type' => 'radios', + '#title' => t('Active access scheme'), + '#options' => $options, + '#description' => t('Select the access scheme to use for the site.'), + '#required' => TRUE, + ); if ($active) { $form['workbench_access']['#default_value'] = $active; } @@ -166,6 +167,9 @@ function workbench_access_settings_form($form, &$form_state) { $form['#validate'][] = 'workbench_access_settings_validate'; $form['#submit'][] = 'workbench_access_settings_submit'; return $form; + } else { + drupal_set_message('Workbench Access requires a hierarchical access scheme. At least module such as Menu or Taxonomy must be enabled in order to define one.', 'warning'); + } } /**