You are here

function views_xml_views_argument in Views Datasource 5

argument hook that will display the XML document or display export icons.

2 calls to views_xml_views_argument()
views_xml_views_handler in ./views_xml.module
handler for our own raw-XML or OPML or structured-XML argument handler
views_xml_views_post_view in ./views_xml.module
post view to display the render icons

File

./views_xml.module, line 76
views_xml.module - provides Views plugin for rendering node content as XML.

Code

function views_xml_views_argument($op, &$view, $arg) {
  if ($op == 'argument' && ($arg == 'xml_raw' || $arg == 'xml_opml' || $arg == 'xml_atom')) {
    $view->page_type = 'views_' . $arg;
  }
  else {
    if ($op == 'post_view' && $view->build_type != 'block') {
      $args = views_post_view_make_args($view, $arg, $arg);
      $url = views_get_url($view, $args);
      $title = views_get_title($view, 'page', $args);
      $links = array();
      if ($arg == 'xml_opml') {
        if ($image = theme('image', drupal_get_path('module', 'views_xml') . '/opml32x32.png', t('OPML'), t('Show @title as OPML.', array(
          '@title' => $title,
        )))) {
          $links[] = l($image, $url, array(
            'class' => 'xml-icon',
          ), $url_filter, NULL, FALSE, TRUE);
          return implode('  ', $links);
        }
      }
      elseif ($arg == 'xml_raw') {
        if ($image = theme('image', drupal_get_path('module', 'views_xml') . '/xml32x36.png', t('Raw XML'), t('Show @title as raw XML', array(
          '@title' => $title,
        )))) {
          $links[] = l($image, $url, array(
            'class' => 'xml-icon',
          ), $url_filter, NULL, FALSE, TRUE);
          return implode('  ', $links);
        }
      }
      elseif ($arg == 'xml_atom') {
        if ($image = theme('image', drupal_get_path('module', 'views_xml') . '/atom80x15.png', t('Atom'), t('Show @title as Atom feed', array(
          '@title' => $title,
        )))) {
          $links[] = l($image, $url, array(
            'class' => 'xml-icon',
          ), $url_filter, NULL, FALSE, TRUE);
          return implode('  ', $links);
        }
      }
    }
  }
}