function view_alias_next_tuple in View Alias 7
Return the next set of objects to be processed. That is, if you have two arguments in the view, tid and tid_1, where there there 3 terms possible in argument tid and 2 in tid_1, then return the next item in the list:
- 0,0
- 1,0
- 2,0
- 0,1
- 1,1
- 2,1
If you have three arguments, return a copy of this with 0..n in the third column.
- 0,0,0
- 1,0,0
- 2,0,0
- 0,1,0
- 1,1,0
- 2,1,0 ...
- 0,0,n
- 1,0,n
- 2,0,n
- 0,1,n
- 1,1,n
- 2,1,n
1 call to view_alias_next_tuple()
- view_alias_pathauto_bulkupdate in ./
view_alias.module - Batch processing callback; Generate aliases for taxonomy terms.
File
- ./
view_alias.module, line 125 - Hook implementations for view alias module integration.
Code
function view_alias_next_tuple($alias) {
// The tuple to construct
$tuple = array();
if (empty($alias->last_tuple)) {
foreach ($alias->objects as $field => $objects) {
$tuple[$field] = $objects[0];
$alias->last_tuple[$field] = 0;
}
return $tuple;
}
$lt =& $alias->last_tuple;
$advance = TRUE;
foreach ($alias->objects as $field => $objects) {
// Do we need to advance the next one, too?
if ($advance) {
$lt[$field]++;
if (!empty($objects[$lt[$field]])) {
$tuple[$field] = $objects[$lt[$field]];
$advance = FALSE;
}
else {
$lt[$field] = 0;
$tuple[$field] = $objects[$lt[$field]];
}
}
else {
$tuple[$field] = $objects[$lt[$field]];
}
}
// If $advance is still set, then we have exhausted all combinations
return $advance ? NULL : $tuple;
}