You are here

function content_pathauto_node in Content Construction Kit (CCK) 5

File

./content_pathauto.inc, line 14
Interface between content.module and pathauto.module.

Code

function content_pathauto_node($op, $node = NULL) {
  switch ($op) {
    case 'placeholders':
      $placeholders = array();
      foreach (content_fields() as $field) {
        $placeholders['[' . $field['field_name'] . ']'] = t($field['widget']['label']);
      }
      return $placeholders;
    case 'values':
      $results = array();

      // Get node output (filtered and with module-specific fields).
      if (node_hook($node, 'view')) {
        node_invoke($node, 'view', false, false);
      }
      else {
        $node = node_prepare($node, false);
      }

      // Allow modules to change $node->body before viewing.
      node_invoke_nodeapi($node, 'view', false, false);

      // Get node output (filtered and with module-specific fields).
      if (node_hook($node, 'view')) {
        node_invoke($node, 'view', false, false);
      }
      else {
        $node = node_prepare($node, false);
      }

      // Allow modules to change $node->body before viewing.
      node_invoke_nodeapi($node, 'view', false, false);
      foreach (content_fields() as $field) {
        $items = $node->{$field}['field_name'];
        $results['[' . $field['field_name'] . ']'] = pathauto_cleanstring(strip_tags($items[0]['view']));
      }
      return $results;
  }
}