Currently, node preview setting is site-wide and not per content type. Having per content type settings is worth considering, since some content types may require a preview but other not. The setting should go in the Submission form settings fieldset, in the content type configuration page.

Comments

dropcube’s picture

Status: Active » Needs review
StatusFileSize
new3.75 KB

The attached patch adds per content type node preview settings. It contains the required modifications and adds an update function to set node preview setting per content type using the previous site-wide setting.

catch’s picture

It seems like an oversight to me that this was never moved to the admin/build/types/$type forms in the first place. It'd also be a first step towards getting rid of the somewhat confusing 'post settings' menu option.

Patch looks fine visually, will test later on.

dropcube’s picture

StatusFileSize
new3.74 KB

Updated patch against HEAD.

swentel’s picture

Patch applies fine and works as intented.

kscheirer’s picture

works for me, patch applied cleanly.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Set preview to required, ran the update, changed the settings also worked fine for me. After this goes in, we could try to remove the 'post settings' page entirely!

swentel’s picture

@catch posted a follow up for this topic on http://drupal.org/node/295570
Hope this gets in soon!

dries’s picture

Status: Reviewed & tested by the community » Needs work

Rather than using a variable, shouldn't this be stored in the node_type table? Other settings like 'min_word_count' are also stored in that table.

swentel’s picture

Hmm, we're not very consistent on that part. Published by default and promoted to frontpage are variables, min_word_count not (which only affects the body). Maybe we should move this all to a separate serialized field in the node_type table? Takes more work me thinks, I might slap myself if you say yes now :)

pasqualle’s picture

consistency: we can't dynamically add/remove columns in {node_type} table when we need, so some settings have to be stored in {variable} table. Storing them in one column as a serialized field would make the code complicated.

logic for storing node type settings:
settings added by hook -> {variable}
grouped settings extensible by a hook -> {variable}
otherwise -> new column in {node_type}

node_preview should go to {node_type} table..

gábor hojtsy’s picture

Moving the published by default and promoted settings to the node_type table also sounds like a good idea. These composite name variables are confusing to say the least anyway. Let's make this issue adding the new setting to the node_type table and open a new issue on moving the existing core variables there. The contrib extensions could still use variables.

gábor hojtsy’s picture

Also, this original site-wide setting is there, but code was not enforcing it in 6.x, and 7.x suffers from the same problem, so it might be a good idea to commit http://drupal.org/node/254242#comment-1015237 in the meantime, while this patch is in limbo.

sun’s picture

Issue tags: +API clean-up

+1

sun’s picture

Status: Needs work » Fixed

Apparently, the preview setting was already moved to a per-node type setting, supporting the three states disabled, optional, and required. So this issue was resolved elsewhere.

The migration from variables to a node_type settings column should be tackled in a separate issue (which might already exist as well).

Status: Fixed » Closed (fixed)
Issue tags: -API clean-up

Automatically closed -- issue fixed for 2 weeks with no activity.