You are here

function forena_report_delete_form in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 forena.report.inc \forena_report_delete_form()
  2. 7.4 forena.report.inc \forena_report_delete_form()

Form to confirm the delete of a form.

Parameters

$form_state:

Return value

unknown_type

File

./forena.report.inc, line 182

Code

function forena_report_delete_form($form_state, $formid, $report_name) {

  // Parse names from url
  $name_in = $report_name;
  $desc = Frx::Menu()
    ->parseURL($report_name);
  $report_name = $desc['name'];
  $language = \Drupal::languageManager()
    ->getCurrentLanguage();
  $link = $desc['link'];
  $form['report_name'] = array(
    '#type' => 'value',
    '#value' => $report_name,
  );
  if (\Drupal::moduleHandler()
    ->moduleExists('locale')) {
    $options = array(
      'all' => t('All Languages'),
      'single' => t('Only %lang', array(
        '%lang' => $language->native,
      )),
    );
    $form['delete_all_languages'] = array(
      '#type' => 'radios',
      '#title' => t('Remove custom reports in all languages?'),
      '#options' => $options,
      '#default_value' => 'single',
    );
    $form['base_name'] = array(
      '#type' => 'value',
      '#value' => $desc['base_name'],
    );
  }
  return confirm_form($form, t('Are you sure you want to remove %title?', array(
    '%title' => $report_name,
  )), isset($_GET['destination']) ? $_GET['destination'] : $link, t('This action cannot be undone.'), t('Remove'), t('Cancel'));
}