hook_domainview($op, $domain = array())
API.php, line 263
Allows Domain modules to add columns to the domain list view at path 'admin/build/domain/view'.
@see domain_user_domaininfo()
$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 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.
| Name | Description |
|---|---|
| Domain hook functions | Core hooks for the Domain module suite. |
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;
}
}