You are here

function views_pdf_plugin_style_table::options_submit in Views PDF 7

Same name and namespace in other branches
  1. 6 views_pdf_plugin_style_table.inc \views_pdf_plugin_style_table::options_submit()
  2. 7.3 views_pdf_plugin_style_table.inc \views_pdf_plugin_style_table::options_submit()
  3. 7.2 plugins/views_pdf_plugin_style_table.inc \views_pdf_plugin_style_table::options_submit()

Options form storage

Overrides views_plugin::options_submit

File

./views_pdf_plugin_style_table.inc, line 341
Table PDF style plugin

Class

views_pdf_plugin_style_table
Style plugin to render each item as a row in a table.

Code

function options_submit(&$form, &$form_state) {
  $default_font_style = $this->display->handler
    ->get_option('default_font_style');
  foreach ($form_state['values']['style_options']['info'] as $id => $field) {

    // Reset to default, if the elements are equal to the default settings
    if (count(array_diff($default_font_style, $field['header_style']['text']['font_style'])) == 0 && count(array_diff($field['header_style']['text']['font_style'], $default_font_style)) == 0) {
      $form_state['values']['style_options']['info'][$id]['header_style']['text']['font_style'] = NULL;
    }
    if ($field['header_style']['text']['align'] == $this->display->handler
      ->get_option('default_text_align')) {
      $form_state['values']['style_options']['info'][$id]['header_style']['text']['align'] = NULL;
    }
    if ($field['header_style']['text']['hyphenate'] == $this->display->handler
      ->get_option('default_text_hyphenate')) {
      $form_state['values']['style_options']['info'][$id]['header_style']['text']['hyphenate'] = NULL;
    }

    // Reset to default, if the elements are equal to the default settings
    if (count(array_diff($default_font_style, $field['body_style']['text']['font_style'])) == 0 && count(array_diff($field['body_style']['text']['font_style'], $default_font_style)) == 0) {
      $form_state['values']['style_options']['info'][$id]['body_style']['text']['font_style'] = NULL;
    }
    if ($field['body_style']['text']['align'] == $this->display->handler
      ->get_option('default_text_align')) {
      $form_state['values']['style_options']['info'][$id]['body_style']['text']['align'] = NULL;
    }
    if ($field['body_style']['text']['hyphenate'] == $this->display->handler
      ->get_option('default_text_hyphenate')) {
      $form_state['values']['style_options']['info'][$id]['body_style']['text']['hyphenate'] = NULL;
    }
  }
}