You are here

function forena_query_delete_form in Forena Reports 7.4

Same name and namespace in other branches
  1. 8 forena_query/forena_query.inc \forena_query_delete_form()
  2. 7.5 forena_query.inc \forena_query_delete_form()
1 string reference to 'forena_query_delete_form'
forena_query_menu in ./forena_query.module
Implementation of hook_menu.

File

./forena_query.inc, line 213

Code

function forena_query_delete_form($form, &$form_state, $block_name) {
  $block_name = str_replace('.', '/', $block_name);
  $o = Frx::BlockEditor($block_name);
  $block = $o->block;
  $file = @$block['file'];
  if ($o->modified) {
    $o
      ->cancel();
    drupal_not_found($block_name);
    exit;
  }
  $form_state['storage']['block_name'] = $block_name;
  $form['block_title'] = array(
    '#markup' => "<h2>{$block_name}</h2>",
  );
  $form['file'] = array(
    '#markup' => "<pre>{$file}</pre>",
  );
  $form['confirm'] = array(
    '#type' => 'checkbox',
    '#title' => t('Are you sure you want to delete this block?'),
    '#required' => TRUE,
  );
  $form['block_name'] = array(
    '#type' => 'value',
    '#value' => $o->block_name,
  );
  $form['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
    '#submit' => array(
      'forena_query_delete_block',
      'forena_query_close',
    ),
  );
  $form['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#submit' => array(
      'forena_query_close',
    ),
    '#limit_validation_errors' => array(),
  );
  return $form;
}