You are here

function hook_domainview in Domain Access 5

Same name and namespace in other branches
  1. 6.2 API.php \hook_domainview()
  2. 7.2 domain.api.php \hook_domainview()

Allows Domain modules to add columns to the domain list view at path 'admin/build/domain/view'.

Parameters

$op: The operation being performed. Valid requests are: -- 'header' defines a column header according to theme_table. -- 'select' defines a string of data to be returned. Must be prefixed. The {domain} table is prefixed with 'd' -- do not select any columns from the domain table. You must not select domain_id from your table. -- 'join' defines a sql join to use to pull extra data. To properly enable sorting of all records, this MUST be a LEFT JOIN. -- 'data' defines the data to be written in the column for the specified domain.

$domain: The $domain object prepared by hook_domainload().

Return value

Return values vary based on the $op value. -- 'header' return a $header array formatted as per theme_table(). -- 'select' return a comman-separated list of fields to select from your table. -- 'join' return a LEFT JOIN statement for connecting your table to the {domain} table. -- 'data' return a $data element to print in the row.

See also

domain_user_domaininfo()

Related topics

1 function implements hook_domainview()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

domain_user_domainview in domain_user/domain_user.module
Implement hook_domainview()
1 invocation of hook_domainview()
domain_view in ./domain_admin.inc
The main administration page, a list of active domains.

File

./API.php, line 263
API documentation file.

Code

function hook_domainview($op, $domain = array()) {
  switch ($op) {
    case 'header':
      return array(
        array(
          'data' => t('MyData'),
          'field' => 'my.uid',
        ),
        array(
          'data' => t('MyName'),
          'field' => 'my.name',
        ),
      );
      break;
    case 'select':
      return 'my.uid, my.name';
    case 'join':
      return "LEFT JOIN {mytable} my ON my.domain_id = d.domain_id";
      break;
    case 'data':
      if ($domain['uid']) {
        $account = user_load(array(
          'uid' => $domain['uid'],
        ));
        return l($account->name, 'user/' . $account->uid);
      }
      break;
  }
}