function forena_report_layout_form in Forena Reports 8
Same name and namespace in other branches
- 7.5 forena.report.inc \forena_report_layout_form()
- 7.4 forena.report.inc \forena_report_layout_form()
File
- ./
forena.report.inc, line 1494
Code
function forena_report_layout_form($form, &$form_state, $report_name) {
$desc = Frx::Menu()
->parseURL($report_name);
$name = $desc['name'];
$r = Frx::Editor($name);
// @FIXME: drupal_set_title() has been removed in Drupal 8. Setting the title is now done in different ways depending on the context. For more information, see https://www.drupal.org/node/2067859
// drupal_set_title(filter_xss($r->title));
// Need to get all option attributes
$frx_options = $r
->getOptions();
$report_form = @$frx_options['form'];
$filter = \Drupal::config('forena.settings')
->get('forena_input_format');
if (isset($frx_options['input_format'])) {
$filter = $frx_options['input_format'];
}
$body = $r->simplexml->body
->asXML();
$css = @(string) $r->simplexml->head->style;
//array of xml attributes that are required to have a value
$required = array(
'id' => TRUE,
'label' => TRUE,
);
$form['report_name'] = array(
'#type' => 'value',
'#value' => $report_name,
);
// Skin control
$frx_options = $r
->getOptions();
$skin = @$frx_options['skin'];
$skins = Frx::File()
->skins();
$form['skin'] = array(
'#type' => 'select',
'#title' => t('Skin'),
'#options' => $skins,
'#empty_option' => t('--use default--'),
'#default_value' => $skin,
'#description' => t('The page style of your report. The {skin}.skin.yml file specifies css and js file in your report.'),
);
$form['body'] = array(
'#type' => 'text_format',
'#title' => t('Body'),
'#default_value' => $body,
'#rows' => 25,
'#format' => $filter,
);
$form['style'] = array(
'#type' => 'fieldset',
'#title' => t('CSS Styles'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['style']['css'] = array(
'#type' => 'textarea',
'#default_value' => $css,
'#description' => t('Specify small css snipets that can be used in the reports.'),
'#rows' => 10,
'#cols' => 80,
);
$form['buttons']['update'] = array(
'#type' => 'submit',
'#value' => 'Update',
'#submit' => array(
'forena_report_layout_form_submit',
),
);
$form['buttons']['cancel'] = array(
'#type' => 'submit',
'#value' => 'Cancel',
'#submit' => array(
'forena_update_cancel',
),
);
return $form;
}