summaryrefslogtreecommitdiff
path: root/modules/path
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-05 22:18:46 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-05 22:18:46 +0000
commit58b0235a72859aa433d743a9f284504f24664857 (patch)
tree524132d2e7ca157baa1059117244a5b27b1f51fb /modules/path
parent0b06c68b988410c49c9f4ffbf8c3160d4e9da2c7 (diff)
downloadbrdo-58b0235a72859aa433d743a9f284504f24664857.tar.gz
brdo-58b0235a72859aa433d743a9f284504f24664857.tar.bz2
- Patch #324313 by catch et al: load multiple nodes and terms at once.
Diffstat (limited to 'modules/path')
-rw-r--r--modules/path/path.module14
-rw-r--r--modules/path/path.test6
2 files changed, 11 insertions, 9 deletions
diff --git a/modules/path/path.module b/modules/path/path.module
index bdc4b2ee5..449b72aba 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -135,12 +135,14 @@ function path_nodeapi_validate(&$node, $arg) {
/**
* Implementation of hook_nodeapi_load().
*/
-function path_nodeapi_load(&$node, $arg) {
- $language = isset($node->language) ? $node->language : '';
- $path = 'node/' . $node->nid;
- $alias = drupal_get_path_alias($path, $language);
- if ($path != $alias) {
- $node->path = $alias;
+function path_nodeapi_load($nodes, $types) {
+ foreach ($nodes as $node) {
+ $language = isset($node->language) ? $node->language : '';
+ $path = 'node/' . $node->nid;
+ $alias = drupal_get_path_alias($path, $language);
+ if ($path != $alias) {
+ $node->path = $alias;
+ }
}
}
diff --git a/modules/path/path.test b/modules/path/path.test
index 40023996d..6479abc03 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -131,7 +131,7 @@ class PathTestCase extends DrupalWebTestCase {
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check to make sure the node was created.
- $node = node_load(array('title' => $edit['title']));
+ $node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertNotNull(($node === FALSE ? NULL : $node), 'Node found in database. %s');
@@ -188,7 +188,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check to make sure the node was created.
- $english_node = node_load(array('title' => $edit['title']));
+ $english_node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertTrue(($english_node), 'Node found in database.');
// Confirm that the alias works.
@@ -209,7 +209,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Ensure the node was created.
// Check to make sure the node was created.
- $french_node = node_load(array('title' => $edit['title']));
+ $french_node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertTrue(($french_node), 'Node found in database.');
// Confirm that the alias works.