1) Create a module with hook_node_info that has a node type with 'base' equal to 'node_content'
2) Enable, check for at structures => content types.
3) Disable module or remove hook_node_info
4) clear cache

The node type will appear under 'content types' still, but be unable to be deleted (or otherwise removed without deleting the node type).

Contrib issue about problem #1055460: Disabling a feature does not disown content type

Patch attach changes the check of base == 'node_content' to empty(custom). As far as I can tell, custom is what it should be checking anyway as !custom indicates the node type was defined from a module (whereas modified indicates the node type has been updated).

This has the effect of node type in that state is instead marked as disabled.

Comments

tim.plunkett’s picture

Issue tags: +Needs backport to D7

Tagging for potential backport.

hefox’s picture

Title: Node types removes from hook_node_info with base = 'node_content' cannot be deleted » Node types removed from hook_node_info with base = 'node_content' cannot be deleted
kscheirer’s picture

kscheirer’s picture

Retesting against latest HEAD since it has been over a year.

The last submitted patch, drupal_hook_node_info_node_content_base.patch, failed testing.

hefox’s picture

Version: 8.0.x-dev » 7.x-dev
Issue summary: View changes

Moving this to d7 because node_content is only referenced once in core, node types are now defined via config, etc.

hefox’s picture

Status: Needs work » Needs review
StatusFileSize
new1.03 KB

Status: Needs review » Needs work

The last submitted patch, 7: 1441950-drupal_node_types_custom-7.patch, failed testing.

hefox’s picture

Status: Needs work » Needs review
StatusFileSize
new1.03 KB

Oops, backported wrong

Status: Needs review » Needs work

The last submitted patch, 9: 1441950-drupal_node_types_custom-8.patch, failed testing.

Status: Needs work » Needs review

The last submitted patch, 7: 1441950-drupal_node_types_custom-7.patch, failed testing.

Leeteq’s picture

Priority: Normal » Major

This core bug has major consequences for other modules / administration.

jaffaralia’s picture

Status: Needs review » Reviewed & tested by the community

I checked this patch was working fine.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: 1441950-drupal_node_types_custom-8.patch, failed testing.

Status: Needs work » Needs review
David_Rothstein’s picture

Status: Needs review » Reviewed & tested by the community

Testbot fluke.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

I think this makes sense.. and existing tests for the node type disabling are somewhat extensive and pass with this patch, so I guess we don't really need new tests for this.

Committed to 7.x - thanks!

  • David_Rothstein committed d67fd28 on 7.x
    Issue #1441950 by hefox: Node types removed from hook_node_info with...
maximpodorov’s picture

Status: Fixed » Closed (fixed)

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

David_Rothstein’s picture

Status: Closed (fixed) » Needs work

Reopening this, since it was reverted in #2465159: 7.36 (Issue #1441950) May Cause Node Types to be disabled.

We can try again if we can figure out how to deal with the regression discussed there. It's definitely a legit bug fix, but that side effect was causing too many problems for some people.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.