You are here

function pathauto_get_placeholders in Pathauto 6

Same name and namespace in other branches
  1. 5.2 pathauto.inc \pathauto_get_placeholders()
  2. 6.2 pathauto.inc \pathauto_get_placeholders()

Generalized function to get tokens across all Pathauto types.

Parameters

$object: A user, node, or category object.

Return value

Tokens for that object formatted in the way that Pathauto expects to see them.

12 calls to pathauto_get_placeholders()
blog_pathauto_bulkupdate in ./pathauto_user.inc
Bulk generate aliases for all blogs without aliases.
contact_pathauto_bulkupdate in ./pathauto_user.inc
Bulk generate aliases for all users without aliases
node_pathauto_bulkupdate in ./pathauto_node.inc
Generate aliases for all nodes without aliases.
PathautoTestHelper::assertTokens in ./pathauto.test
pathauto_form_alter in ./pathauto.module
Implements hook_form_alter().

... See full list

File

./pathauto.inc, line 564
Miscellaneous functions for Pathauto.

Code

function pathauto_get_placeholders($type, $object) {
  if (!function_exists('token_get_values')) {

    // TODO at some point try removing this and see if install profiles have problems again.
    watchdog('Pathauto', 'It appears that you have installed Pathauto, which depends on token, but token is either not installed or not installed properly.');
    return array(
      'tokens' => array(),
      'values' => array(),
    );
  }
  $options = array(
    'pathauto' => TRUE,
  );
  $full = token_get_values($type, $object, TRUE, $options);
  $tokens = token_prepare_tokens($full->tokens);
  $values = pathauto_clean_token_values($full, $options);
  return array(
    'tokens' => $tokens,
    'values' => $values,
  );
}