You are here

function colorbox_node_url_load in Colorbox Node 7.3

Same name and namespace in other branches
  1. 7 colorbox_node.module \colorbox_node_url_load()
  2. 7.2 colorbox_node.module \colorbox_node_url_load()

Takes a path as an array of all our arguments from the url structure. We then put that structure back together, find our system path and then return it.

File

./colorbox_node.module, line 321
Creates a menu callback with support for displaying a node inside of a colorbox.

Code

function colorbox_node_url_load($arg, $path = array()) {

  // First lets remove 'colorbox'
  array_shift($path);

  // Lets determine if we have a prefix from our languages.
  if (module_exists('locale') && function_exists('language_url_split_prefix')) {

    // Get our language list to pass into our url splitter.
    $languages = language_list();

    // Turn the path into a string so we can then remove our prefix.
    $path_string = implode('/', $path);
    $language_path = language_url_split_prefix($path_string, $languages);

    // Separate out the returned path and language.  We should always
    // have two indexes, the first is the language, second is the path.
    $language = $language_path[0] ? $language_path[0]->language : '';
    $final_path = $language_path[1];

    // Lets find our path based on the current translation.
    return drupal_get_normal_path($final_path, $language);
  }

  // Now lets buld our path to return our system path,
  return drupal_get_normal_path(implode('/', $path));
}