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.

2
  • 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. Commented May 24, 2013 at 9:48
  • Similar question drupal.stackexchange.com/questions/17118/… Commented May 24, 2013 at 11:09

1 Answer 1

1

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'));
2
  • 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?
    – dbj44
    Commented May 24, 2013 at 11:58
  • Yes, that appears to be the case. Commented May 24, 2013 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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