1

For example, if I want to set 'Publishing options - Promoted to front page' to 0 in a .install file when creating a new content type.

I've looked in the variable table, where I was expecting to see variables for these options, but it's not obvious to me. What am I supposed to set?

Thanks.

  • One way to check would be to download a copy of the Features module and quickly make a feature of a content type (on a backup site). Then you could check what variables Features adds to the feature module. – Patrick Kenny May 24 '13 at 9:48
  • Similar question drupal.stackexchange.com/questions/17118/… – Anoop Joseph May 24 '13 at 11:09
0

You can set a node_options_[type] variable,

e.g:

node_options_article: Array
(
    [0] => status
    [1] => promote
)

which can be set with:

// Make my_type nodes published and not promoted to front page by default
variable_set('node_options_my_type', array('status'));
  • Thanks. So variable_set will create node_options_my_type in the variable table. And the exclusion of 'promote' in the array passed to varaible_set will set it to false and the inclusion of 'status' sets it to true, correct? – 24ma13wg May 24 '13 at 11:58
  • Yes, that appears to be the case. – David Thomas May 24 '13 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.