You are here

function forena_query_validate_new_block in Forena Reports 7.3

1 string reference to 'forena_query_validate_new_block'
forena_query_builder_form in ./forena_query.inc

File

./forena_query.inc, line 347

Code

function forena_query_validate_new_block($form, &$form_state) {

  // Check to make sure a filename is specified.
  if (isset($form_state['values']['save_as_name'])) {
    $block_name = $form_state['storage']['provider'] . '/' . $form_state['values']['save_as_name'];
    $block = Frx::RepoMan()
      ->loadBlock($block_name);
    if ($block) {
      form_set_error('save_as_name', t('Block already exists'));
    }
  }
  if (isset($form_state['values']['access'])) {
    $r = Frx::RepoMan()
      ->repository($form_state['storage']['provider']);
    $access = $r
      ->access($form_state['values']['access']);
    if (!$access) {
      form_set_error('access', 'You must have access to use this right.');
    }
  }
}