开发者

Drupal webform module hiding content on multipage form

We have multipage forms built using the webforms module. On any page numbered greater than 0 we want to hide the node content. This content can be quite long and doesn't need to display on each page of the form.

So I've added a custom module and added to it...

开发者_StackOverflow
/**
 * Implementation of hook_form_alter().
 */
function bmc_customisations_form_alter(&$form, $form_state, $form_id) {
    //dpm('form state page_num is '.$form_state['values']['details']['page_num']);
    //hide node body on multi-page forms if not first page
    if ($form_state['values']['details']['page_num'] > 0) {
        //dpm($form);
        dpm($form['#node']->body);
        $form['#node']->body= '';
        dpm($form['#node']->body);
    }
}

I can see that $form['#node']->body is being replaced with my empty string but the displayed page still has the body text. So I guess the node is built and then the form added to it.

Am I running a fool's errand?


User vernond on the drupal site pointed out that it is possible to simply use a markup field on page 0 instead of node content and that text will then only appear on page 0. Simples!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜