💾 Archived View for chirale.org › 2009-12-07_375.gmi captured on 2024-07-08 at 23:24:47. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-12)
-=-=-=-=-=-=-
Following code is useful when installing a module that create a new content type programmatically on Drupal x.
Basically, it adds two variables setting default values for comments (core Comment module) and attachments (core Upload module).
Code to write on my_funny_module/my_funny_module.install.
function my_funny_module_install() { // Disable attachments // Read http://api.drupal.org/api/function/upload_nodeapi/6 on "load" variable_set("upload_my_content_type", 0); // Disable comments for this content type // Read http://api.drupal.org/api/function/comment_form_alter/6 variable_set('comment_my_content_type', COMMENT_NODE_DISABLED); // Install schema as usual (if any) drupal_install_schema('my_funny_module'); }
Note that this code assign only default values for my_content_type: as any content type, this value could be later changed via GUI.