You are here

function views_pdf_rules_action_save in Views PDF 6

Same name and namespace in other branches
  1. 8 views_pdf.rules.inc \views_pdf_rules_action_save()
  2. 7.3 views_pdf.rules.inc \views_pdf_rules_action_save()
  3. 7 views_pdf.rules.inc \views_pdf_rules_action_save()
  4. 7.2 views_pdf.rules.inc \views_pdf_rules_action_save()

File

./views_pdf.rules.inc, line 67
Rules integration of the mimemail and the PDF Views module.

Code

function views_pdf_rules_action_save($settings) {
  $view_name = $settings['views_pdf'];
  $arguments = $settings['arguments'];
  $path = $settings['path'];
  if (!empty($view_name)) {
    $view = views_get_view($view_name);
    $view
      ->set_arguments(explode(',', $arguments));

    // Try to get pdf display
    if (!$view
      ->set_display('pdf')) {

      // Try the display type
      if (!$view
        ->set_display('pdf_1')) {

        // There is definitly no pdf display
        return;
      }
    }
    $view
      ->pre_execute();
    foreach ($view->display as $id => $display) {
      if ($display->display_plugin == 'pdf' && isset($display->handler)) {
        $display->handler
          ->execute($path, 'F');
      }
    }
  }
}