You are here

function views_pdf_rules_action_save in Views PDF 7.3

Same name and namespace in other branches
  1. 8 views_pdf.rules.inc \views_pdf_rules_action_save()
  2. 6 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 61
Rules integration of the mimemail and the PDF Views module.

Code

function views_pdf_rules_action_save($views_pdf, $arguments, $path) {
  $splits = explode(':', $views_pdf);
  $view_id = $splits[0];
  $display_id = $splits[1];
  if (!empty($view_id)) {
    $view = views_get_view($view_id);
    $view
      ->set_arguments(preg_split("/\r\n|\n|\r/", $arguments));

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

      // 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) && $id == $display_id) {
        $display->handler
          ->execute($path, 'F');
      }
    }
  }
}