Dont render "Preview" button if $form['preview']['#type'] explicitly set to "hidden"

Means that using formsAPI you can hide the preview button, ofcourse you need to make sure administer > settings > posts > Preview post is set to "Optional"

Eventually this should be a per-node-type basis

CommentFileSizeAuthor
node-anti-preview.patch.txt772 bytesdgtlmoon

Comments

chx’s picture

Status: Needs review » Closed (won't fix)

Aside from the patch is reversed, the problem is that if you do not want a form element to be present, then you simply unset it and not change its type.

dgtlmoon’s picture

Correct, ive since learnt that the correct way to remove / disable the form preview button is via..

  function MODULENAME_form_alter($form_id, &$form) {
    unset($form["preview"]);
  }

thanks!