Skip to content
Snippets Groups Projects
Commit 365aa6ab authored by AlexisWilke's avatar AlexisWilke
Browse files

* Added support for the webform module.

parent 9bc4c9d4
No related branches found
No related tags found
No related merge requests found
......@@ -206,6 +206,12 @@ function InsertNode_theme() {
),
'file' => 'InsertNode.pages.inc',
),
'InsertNode_webform' => array(
'arguments' => array(
'node' => NULL,
),
'file' => 'InsertNode.pages.inc',
),
);
}
......
......@@ -180,7 +180,8 @@ function _InsertNode_replacer($matches) {
case 'cckteaser':
$show_teaser = TRUE;
case 'cck':
if ($p == 'body') {
switch ($p) {
case 'body':
// the user wants to see the body as is (without decorations)
$body = str_replace('<!--break-->', '', $node->body);
$output .= check_markup($body, $node->format, FALSE);
......@@ -188,20 +189,23 @@ function _InsertNode_replacer($matches) {
// we want to make sure that the default doesn't get inserted
$output = ' ';
}
}
elseif ($p == 'teaser') {
break;
case 'teaser':
// the user wants to see the teaser as is (without decorations)
$output .= check_markup($node->teaser, $node->format, FALSE);
if (!$output) {
// we want to make sure that the default doesn't get inserted
$output = ' ';
}
}
elseif ($p == 'title') {
break;
case 'title':
// the user wants to see the title as is (without H3)
$output .= check_plain($node->title);
}
elseif ($p == 'book_children') {
break;
case 'book_children':
if ($node->book) {
$output .= theme('InsertNode_book_children', $node->book);
}
......@@ -209,8 +213,9 @@ function _InsertNode_replacer($matches) {
// we want to make sure that the default doesn't get inserted
$output = ' ';
}
}
elseif ($p == 'book_navigation') {
break;
case 'book_navigation':
if ($node->book) {
$output .= theme('book_navigation', $node->book);
}
......@@ -218,16 +223,27 @@ function _InsertNode_replacer($matches) {
// we want to make sure that the default doesn't get inserted
$output = ' ';
}
}
elseif (module_exists('content')) { // the content module is optional
// add the CCK content (Note: CCK permissions == Node permissions)
$field = content_fields($p);
if (is_array($field)) {
$output .= content_view_field($field, $node, $show_teaser, FALSE);
break;
case 'webform':
if ($node->webform) {
theme('webform', $node);
}
}
else {
$comments .= "<em>" . t("Cannot find the 'content' (or CCK) module! <a href=\"/admin/build/modules\">Was it selected</a>?") . "</em>";
break;
default:
if (module_exists('content')) { // the content module is optional
// add the CCK content (Note: CCK permissions == Node permissions)
$field = content_fields($p);
if (is_array($field)) {
$output .= content_view_field($field, $node, $show_teaser, FALSE);
}
}
else {
$comments .= "<em>" . t("Cannot find the 'content' (or CCK) module! <a href=\"/admin/build/modules\">Was it selected</a>?") . "</em>";
}
break;
}
$show_teaser = FALSE;
break;
......@@ -555,6 +571,16 @@ function theme_InsertNode_node($node, $output, $insert_node_count) {
return '<span' . $classes . '>' . $output . '</span>';
}
/**
* Use this theme by default when no other option was specified (and thus
* the output is still empty after we're done with the user options.)
*
* By default, this is similar to the theme_InsertNode_content() function.
*/
function theme_InsertNode_webform($node) {
return '<div class="insert-webform-content">' . webform_view($node, FALSE, TRUE) . '</div>';
}
/**
* Process variables for InsertNode-book-children.tpl.php.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment