You are here

function shorten_token_values in Shorten URLs 6

Implementation of hook_token_values().

File

./shorten.module, line 628
Shortens URLs via external services.

Code

function shorten_token_values($type, $data = NULL, $options = array()) {
  if ($type == 'node' && variable_get('shorten_generate_token', 1)) {

    //Casting $data to an object may not be necessary.
    $data = (object) $data;
    return array(
      'url' => shorten_url(url('node/' . $data->nid, array(
        'absolute' => TRUE,
        'alias' => variable_get('shorten_use_alias', 1),
      ))),
    );
  }
}