You are here

function hansel_domain_action_add_domain_get_crumbs in Hansel breadcrumbs 8

Same name and namespace in other branches
  1. 7 domain/hansel_domain.module \hansel_domain_action_add_domain_get_crumbs()

Callback for "add domain" breadcrumb action

Parameters

array $arguments Values from the configuration form.:

Return value

array

1 string reference to 'hansel_domain_action_add_domain_get_crumbs'
hansel_domain_hansel_action_types in domain/hansel_domain.module
Implements hook_hansel_action_types().

File

domain/hansel_domain.module, line 28
Hansel domain integration

Code

function hansel_domain_action_add_domain_get_crumbs($arguments) {
  global $_domain, $_hansel_flags;
  if (in_array('alias', $_hansel_flags) || in_array('menu', $_hansel_flags)) {

    // Do not add crumbs when generating the alias token or menu path.
    return array();
  }
  if (empty($_domain)) {

    // This happens only if the domain module is not installed correctly
    return array();
  }
  $domain_id = isset($arguments['domain_id']) ? $arguments['domain_id'] : 0;
  if ($domain_id == 0 || $domain_id == $_domain['domain_id']) {
    $domain = $_domain;
  }
  else {
    if (!($domain = domain_load($domain_id))) {
      return array();
    }
  }
  $directory = '';
  if (module_exists('dominion')) {
    if ($subsite = dominion_get_info($domain['domain_id'])) {
      $directory = isset($subsite->directory) ? $subsite->directory : '';
    }
  }
  return array(
    array(
      'title' => $domain['sitename'],
      'href' => $domain['path'] . $directory,
    ),
  );
}