function _insert_view_substitute_tags in Insert View 6
Same name and namespace in other branches
- 5 insert_view.module \_insert_view_substitute_tags()
- 6.2 insert_view.module \_insert_view_substitute_tags()
- 7.2 insert_view.module \_insert_view_substitute_tags()
1 call to _insert_view_substitute_tags()
File
- ./
insert_view.module, line 82
Code
function _insert_view_substitute_tags($text) {
if (preg_match_all("/\\[view(_pager)?:([^=\\]]+)=?([^=\\]]+)?=?([^\\]]*)?\\]/i", $text, $match)) {
foreach ($match[3] as $key => $value) {
// view_pager syntax is deprecated in the D6 version, but leaving in for
// now so we don't break people's legacy tags
$match[1][$key] == '_pager' ? $pager = TRUE : ($pager = FALSE);
// not used
$viewname = $match[2][$key];
$display = $match[3][$key] && !is_numeric($match[3][$key]) ? $match[3][$key] : 'default';
$view_args = $match[4][$key];
$view = views_get_view($viewname);
$replace = "";
if ($view_args != NULL) {
$view_args = explode(',', $view_args);
}
else {
$view_args = array();
}
if ($view) {
// render our previously gotten view, providing it with our matched
// display (or default) and matched arguments
$replace = $view
->preview($display, $view_args);
$mtch[] = $match[0][$key];
$repl[] = $replace;
}
}
return str_replace($mtch, $repl, $text);
}
return $text;
}