Newer
Older
Jonathan Chaffer
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
// $Id$
/**
* @file
* Interface between content.module and pathauto.module.
*/
/*
* Implementation of hook_pathauto_node().
*
* Allows users to use the textual representation of any field as a component
* of paths.
*/
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;
}
}