You are here

function domain_path_path_save in Domain Path 7

Save a domain path alias to the database.

Parameters

$path: An associative array containing the following keys:

  • source: The internal system path.
  • domain_id: The domain ID (required if dpid is not set).
  • alias: The URL alias.
  • dpid: (optional) Unique domain path alias identifier.
  • language: (optional) The language of the alias.

$reset: A boolean value to reset the domain_path_lookup_path static cache. (Useful if you are saving multiple paths at once.)

1 call to domain_path_path_save()
domain_path_save_paths in ./domain_path.module
A helper function to save multiple domain paths at once.

File

./domain_path.module, line 457
Path alias handling for multiple domains.

Code

function domain_path_path_save(&$path, $reset = TRUE) {
  $path += array(
    'language' => LANGUAGE_NONE,
  );

  // Load the stored alias, if any.
  if (!empty($path['dpid']) && !isset($path['original'])) {
    $path['original'] = domain_path_path_load($path['dpid']);
  }
  if (empty($path['dpid'])) {
    drupal_write_record('domain_path', $path);
    module_invoke_all('domain_path_insert', $path);
  }
  else {
    drupal_write_record('domain_path', $path, array(
      'dpid',
    ));
    module_invoke_all('domain_path_update', $path);
  }

  // Clear internal properties.
  unset($path['original']);
  if ($reset) {

    // Rebuild the node alias.
    drupal_static_reset('domain_path_lookup_path');
  }
}