You are here

function forena_report_layout_form_submit in Forena Reports 8

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

builds a string of the xml document, submits it to forena_save_report.

1 string reference to 'forena_report_layout_form_submit'
forena_report_layout_form in ./forena.report.inc

File

./forena.report.inc, line 1593

Code

function forena_report_layout_form_submit($form, &$form_state) {
  $nodes = array();
  $rebuild_menu = FALSE;
  $values = $form_state['values'];
  $report_name = $values['report_name'];
  $r = Frx::Editor();
  $r_link = $r->report_link;
  $options = array();
  $filter = \Drupal::config('forena.settings')
    ->get('forena_input_format');
  if (isset($values['body']['format']) && $values['body']['format'] != $filter) {
    $options['input_format'] = $values['body']['format'];
  }
  $options['skin'] = $values['skin'];
  $r
    ->setOptions($options);

  // Body
  $r
    ->setBody($values['body']['value']);

  // CSS
  $r
    ->setStyle($values['css']);
  $r
    ->update();

  // If we changed the menu we need to rebuild it.
  $form_state['redirect'] = array(
    "{$r_link}/edit",
    array(
      'query' => Frx::parms(),
    ),
  );
}