domain_views_handler_arg_domain_id

Definition

domain_views_handler_arg_domain_id($op, &$query, $argtype, $arg = '')
domain_views/domain_views.module, line 97

Description

This is the function that handles all the work for dealing with view arguments There is some *very rough* documentation on argument handlers for views here http://drupal.org/node/99566.

Code

function domain_views_handler_arg_domain_id($op, &$query, $argtype, $arg = '') {
  switch ($op) {
    case 'summary':
      $query->add_table('domain_access'); // Re-uses the node_access table info from the domain_views_tables() function
      $query->add_table('domain');        // Re-uses the domain table info from the domain_views_tables() function
      $query->add_field('sitename', 'domain');
      $query->add_field('domain_id', 'domain');
      $query->add_where("domain.valid = '%s'", 1);  // don't show summary item for inactive domains
      $fieldinfo['field'] = "domain.domain_id";
      return $fieldinfo;
    case 'sort':
      $query->add_orderby('domain', 'sitename', $argtype);
      break;
    case 'filter':
      $domain_id = ($arg == 'current') ? (int) $GLOBALS['_domain']['domain_id'] : (int) $arg;
      $query->add_table('domain_access');
      $query->add_where("domain_access.gid = '%s'", $domain_id);  // domain_access is an alias for the node_access table
      $query->set_distinct();
      break;
    case 'link':
      return l($query->sitename, "$arg/" . intval($query->domain_id));
    case 'title':
      return '';
  }
}