You are here

function domain_alias_domainview in Domain Access 6.2

Same name and namespace in other branches
  1. 7.2 domain_alias/domain_alias.module \domain_alias_domainview()

Implement hook_domainview().

File

domain_alias/domain_alias.module, line 323
Interface for advanced domain matching for Domain Access.

Code

function domain_alias_domainview($op, $domain = array()) {
  switch ($op) {
    case 'header':
      return array(
        array(
          'data' => t('Aliases'),
        ),
      );
      break;
    case 'data':
      if (empty($domain)) {
        return;
      }
      $aliases = domain_alias_list($domain['domain_id']);
      $pieces = array();
      foreach ($aliases as $alias) {
        if (strpos($alias['pattern'], '*') === FALSE) {
          $link = str_replace($domain['subdomain'], $domain['aliases'][$alias['alias_id']]['pattern'], domain_get_uri($domain));
          $pieces[] = l($alias['pattern'], $link, array(
            'absolute' => TRUE,
          ));
        }
        else {
          $pieces[] = $alias['pattern'];
        }
      }
      $linktext = empty($pieces) ? 'add alias' : 'edit aliases';
      $action[] = l($linktext, 'admin/build/domain/alias/' . $domain['domain_id']);
      $pieces = array_merge($action, $pieces);
      return theme('item_list', $pieces);
      break;
  }
}