You are here

function calendar_plugin_row::options_submit in Calendar 7.3

Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.

Overrides views_plugin_row_fields::options_submit

File

includes/calendar_plugin_row.inc, line 265
Contains the Calendar row style plugin.

Class

calendar_plugin_row
Plugin which creates a view on the resulting object and formats it as a Calendar node.

Code

function options_submit(&$form, &$form_state) {
  parent::options_submit($form, $form_state);
  if ($this->view->base_table == 'node') {
    if (isset($this->view->display['default']->display_options['link_display'])) {
      $default_display = $this->view->display['default']->display_options['link_display'];
      if (isset($this->view->display[$default_display])) {
        $path = $this->view->display[$default_display]->handler
          ->get_option('path');

        // If this display has been set up as a default tab, the current path
        // is actually the base path, i.e. if the path is 'calendar/month'
        // and this is a default tab, the path for this display will actually
        // be 'calendar'.
        if ($this->view->display[$default_display]->handler->options['menu']['type'] == 'default tab') {
          $parts = explode('/', $path);
          array_pop($parts);
          $path = implode('/', $parts);
        }
        calendar_clear_link_path($path);
        if (!empty($form_state['values']['row_options']['calendar_date_link'])) {
          $node_type = $form_state['values']['row_options']['calendar_date_link'];
          calendar_set_link('node', $node_type, $path);
        }
      }
    }
  }
}