You are here

function og_pathauto_node in Organic groups 5

Same name and namespace in other branches
  1. 5.8 og.module \og_pathauto_node()
  2. 5.2 og.module \og_pathauto_node()
  3. 5.3 og.module \og_pathauto_node()
  4. 5.7 og.module \og_pathauto_node()

File

./og.module, line 2879

Code

function og_pathauto_node($op, $node = NULL) {
  switch ($op) {
    case 'placeholders':
      $placeholders = array();
      $placeholders[t('[ogname]')] = t('The name of the organic group this post belongs to.');
      return $placeholders;
    case 'values':
      $results = array();
      if ($node->og_groups) {
        foreach ($node->og_groups as $gid) {
          if ($gid != 0) {
            $name = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $gid));
            break;
          }
        }
      }
      $results[t('[ogname]')] = pathauto_cleanstring($name);
      return $results;
    default:
      break;
  }
}