Docs say that title_label shouldn't need to be declared in hook_node_info(). Unfortunately an error is thrown if it isn't declared. Not sure if bug reports start in 6.x or 7.x, but I found it in Drupal 6.

CommentFileSizeAuthor
#5 node.patch983 bytesSusurrus
#1 patch.txt1.7 KBSusurrus
patch.txt1.02 KBSusurrus
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Susurrus’s picture

FileSize
1.7 KB

Looks like I missed another section where an error is thrown.

Susurrus’s picture

Title: Error when title_label note declared in hook_node_info() » Error when title_label not declared in hook_node_info()
Damien Tournoud’s picture

It seems like you are somehow fixing a symptom, and not the real bug.

In _node_type_set_defaults() there is some code to ensure sane default for node types. This function sets $type->title_label if unset, but only if $type->has_title is true.

So I guess you are in the case where $type->has_title is false. After giving that some thoughts, I guess we should change the way _node_type_set_defaults() behaves. There is the same problem with $type->body_label.

When that function will be fixed, I guess we could remove the $type->body_label check in node_type_save().

Damien Tournoud’s picture

Status: Needs review » Needs work

Back to code needs work, if you don't mind.

Susurrus’s picture

Title: Error when title_label not declared in hook_node_info() » Error when title_label is not declared in hook_node_info()
Status: Needs work » Needs review
FileSize
983 bytes

Here's an updated version that seems to fix this issue while setting the defaults in _node_type_set_defaults(). I'm not sure how closely related these two issues are, but when the title is set to false, I'm still running into this problem: #265031: Not having title attribute on $node object throws errors when title not defined for content type.

Damien Tournoud’s picture

The patch in #5 looks good, but we need a better review from someone more familiar than me with that part of the code.

At first sight, the issue in #265031 does not seems to be closely related.

Damien Tournoud’s picture

Version: 6.x-dev » 7.x-dev
Status: Needs review » Patch (to be ported)

Bumping to D7, where the bug needs to be fixed before backporting to D6.

marcingy’s picture

Version: 7.x-dev » 6.x-dev
Status: Patch (to be ported) » Needs work

Back to d6 as this code is no longer relevant in d7.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.