It seems to me the definition of the $node_example array is wrong in node_example.install. It uses a key 'body_label' which according to the documentation of node_type_set_defaults does not exist:

$node_example = array(
    'type' = > 'node_example',
    'name' => $t('Example Node'),
    'base' => 'node_content',
    'description' => $t('This is an example node type with a few fields.'),
    'body_label' => $t('Example Description'),
);

Probably this should be

    'title_label' => $t('Example Description'),

(Body label can be set with node_add_body_field($content_type,$t('Example Description )), I think)

Comments

rfay’s picture

Thanks! Looking forward to your patch.

Jef-DS’s picture

Status: Active » Needs review
StatusFileSize
new1.56 KB

I've changed the code to set the body label in a proper way. I've also added an alternative way (commented out) to set the label on the body instance. I hope this makes it a bit more clear.
Since this is the first Drupal patch I submit, I hope it works out OK. If I have done something wrong or haven't followed the proper procedures, I am always open to suggestions.

rfay’s picture

Well, it passes the testbot! Could you please check and see if this has proper test coverage? Thanks for your first patch!

Jef-DS’s picture

StatusFileSize
new2.39 KB

The body label was not tested (obviously).
I don't really know how to test this, so I've tried with a get request and checking whether the text 'Example Description' was present. But if you've got any pointers on how to test this more properly, I would be much obliged. Because this test looks rather weird to me.

Jef-DS’s picture

StatusFileSize
new2.9 KB

I've 'patched' the patch a bit. Instead of using assertText, I'm using assertRaw to test for the presence of the body label. But if anybody has a better idea, feel free to comment.

    $this->drupalGet('node/add/node-example');
    $this->assertResponse(200, 'node/add/node-example page found');
    $this->assertRaw('<label for="edit-body-und-0-value">Example Description </label>', 'Body label equals \'Example Description\'');

Status: Needs review » Needs work

The last submitted patch, body-label-1175288-5.patch, failed testing.

Jef-DS’s picture

Status: Needs work » Needs review

#4: body-label-1175288-4.patch queued for re-testing.

Jef-DS’s picture

So it seems my latest patch breaks the comment block tests. I guess I'll have to look into that...

Jef-DS’s picture

#4: body-label-1175288-4.patch queued for re-testing.

Jef-DS’s picture

#5: body-label-1175288-5.patch queued for re-testing.

cyberswat’s picture

Status: Needs review » Active

let's poke the bot a bit

cyberswat’s picture

Status: Active » Needs review
rfay’s picture

#5: body-label-1175288-5.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, body-label-1175288-5.patch, failed testing.

rfay’s picture

Priority: Minor » Normal
Status: Needs work » Needs review
StatusFileSize
new2.81 KB

Reroll of #5 to current.

Status: Needs review » Needs work

The last submitted patch, examples.node_example_body_label_1175288_15.patch, failed testing.

rfay’s picture

Status: Needs work » Needs review
StatusFileSize
new2.85 KB

Except that I messed up of course. Another reroll of #5

rfay’s picture

And rerolled again after the doxygen patch went in...

rfay’s picture

If this is OK, please RTBC it and let's get it in before we all forget what it was about.

rfay’s picture

rfay’s picture

@cyberswat, @Jef-DS if you'll just confirm, let's commit.

Jef-DS’s picture

It's OK by me. Do I have to do anything else to confirm this?

rfay’s picture

If you have reviewed the code and tested the patch, just say what you've done and set it to RTBC. Thanks!

Jef-DS’s picture

@rfay. I'm not sure about this, but since I'm the one who filed the patch in the first place, I don't think I'm the proper person to RTBC it. Or am I mistaken? (I would feel more comfortable anyway when a more experienced developer would take a look at it, especially as far as the testing code is concerned)

rfay’s picture

You're RTBC'ing my rerolls... That's generally considered OK.

I think you may be the "more experienced developer" here, but would love for @cyberswat to chime in too. There are pretty weird and obscure things.

cyberswat’s picture

Status: Needs review » Reviewed & tested by the community

Looks good .. thanks!

rfay’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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