This issue is for tracking / documenting API changes that are made for Domain Access hooks in D7.

Comments

agentrickard’s picture

Deprecated:

hook_domainrecords() use hook_node_grants_alter()
hook_domaingrants() use hook_node_access_records_alter()

These are now core features. Be careful when using hook_node_access_records_alter() that you are now responsible for updating the {domain_access} table properly, as that table will be populated before your hook fires.

agentrickard’s picture

hook_domainview() has changed to match the new database layer.

/**
 * Allows Domain modules to add columns to the domain list view at
 * path 'admin/config/domain/view'.
 *
 * @param $op
 *   The operation being performed.  Valid requests are:
 *   -- 'header' defines a column header according to theme_table.
 *   -- 'query' passes the query object that defines the table structure.
 *       Your module should add its joins and fields here.
 *   -- 'data' defines the data to be written in the column for the
 *       specified domain. These will match the order of your $header.
 * @param $domain
 *   The $domain object prepared by hook_domainload().
 * @return
 *   Return values vary based on the $op value.
 *   -- 'header' return a $header array formatted as per theme_table().
 *   -- 'query' modify the $query object. For details see
 *       @link http://drupal.org/node/310075
 *   -- 'data' return an array of $data elements to print in the row.
 *
 * @see domain_user_domaininfo()
 *
 * @ingroup domain_hooks
 */
function hook_domainview($op, $domain = array(), $query = NULL) {
  switch ($op) {
    case 'header':
      return array(array('data' => t('UID'), 'field' => 'de.uid'));
      break;
    case 'query':
      $query->leftJoin('domain_editor', 'de', 'd.domain_id = de.domain_id');
      $query->addField('de', 'uid');
      break;
    case 'data':
      return array($domain['uid']);
      break;
  }
}
agentrickard’s picture

Use $_domain = domain_get_domain(); instead of global $_domain; whenever you need to access the $_domain global in READ-ONLY mode.

agentrickard’s picture

Status: Active » Needs work
StatusFileSize
new64.63 KB

Big patch that cleans up API hooks and introduces the use of $module.domain.inc files.

Needs some documentation, perhaps.

Committed to HEAD.

HEAD and 7.x.2 branch are now incompatible.

agentrickard’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
agentrickard’s picture

DEPRECATED:

hook_domainview()
hook_domainlinks()

Menu callbacks for domain subtasks are now MENU_LOCAL_TASK or the path /admin/structure/domain/view/%domain/YOURMODULE

pillarsdotnet’s picture

Component: Documentation » - Domain Content
Status: Needs work » Needs review
StatusFileSize
new5.49 KB

I hope this is the right place to post this.

Following patch applies to 7.x-3.x-dev checkout and moves paths from admin/domain/content to admin/structure/domain/content

agentrickard’s picture

Status: Needs review » Closed (works as designed)

That would be a separate issue, and for me, those paths are correct. I intend to have a top-level admin item there.

Even so, /structure would be the wrong path here.

This issue can probably be closed. It was designed to warn other developers about API changes.