This is an oldie that I remember really bugging the crap out of me before I got used to the way things work... thanks to merlinofchaos for bringing it up again. ;)

On a typical site, it's feasible that you want to make certain node type settings the default for all content types unless otherwise specified: for example, disabling upload.module on all but "file" nodes, or not publishing anything to the front page other than "blog" nodes. Because the node type form always takes its defaults from the arbitrary pre-defined defaults in whatever module, it's impossible to do this, so you invariably end up missing a couple here and there and having to back-track. Annoying.

So let's provide the ability to set those node type options in one place globally (I'm thinking admin/content/type/settings), and have the other node type forms use that unless otherwise specified.

Comments

webchick’s picture

The only way I can think of to do this is to re-introduce something like hook_nodeapi op settings... and use one of the params as a $type op which indicates whether we're addressing the 'global' settings or the 'per-type' settings, so that it knows where to pull the default values from/where to save the value.

This op was done away with in 4.7 in favour of hook_form_alter. Which mostly makes sense; it's just a form after all. However, node_type_form does one very distinct thing, which is to actually create/edit a node type. All these node type options coming from other modules just get slapped onto the end of the form; there's no separation between "this is stuff we need to actually build the node type" and "these are options we want to happen to all nodes of this type."

Any other thoughts here are welcome.

webchick’s picture

Actually, better would be adding the settings op to hook_node_type. However, this feels dirty, because it's introducing yet another way/place to alter forms. Hmmm....

mlncn’s picture

Version: 6.x-dev » 7.x-dev

Updating version. Worth looking at again after Remove $op from hook_node_type lands.

sun.core’s picture

Version: 7.x-dev » 8.x-dev
webchick’s picture

Assigned: webchick » Unassigned

Not sure why that was assigned to me. :)

peterx’s picture

There is a need to create default settings for modules that create several types. There is a need and several issues requesting the change from a default of published to unpublished. I was about to contribute code to the published/unpublished issues and thought this issue could be a better starting point for many content type definition issues.

The defaults for a module could be set in the module.info file. I created a module to do this many years ago and finally published the D7 version: http://petermoulding.com/content_type. The same code could be used for the site wide defaults.

The old code has default settings for the module, something that could be moved to the D7 version. D8 could have a site wide .info file to be read during the installation to set the defaults site wide. There would then be a consistency. site.info then module.info then content_type.info. Whatever is not set is inherited.

The D7 version can handle everything except site.info. The D8 version could handle site.info. While the code would not be backward compatible, the content type definition files could be backward compatible.

The text files would be very easy to edit and to version control. They are read only when you switch on a module. Theme developers are already familiar with the format of .info files. If we remove the need for a module.module file in a module, a content type module could be a single .info file and the file could be created by someone who has never written PHP code.

My code allows for content types stored in separate files with any name. If you want to keep .info clean, the only addition needed is content_type[] = file_name.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This can now be done with the configuration management system. I am closing as outdated.