Node type is object. Use $bundle->type instead of $bundle

http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...

CommentFileSizeAuthor
hook_field_extra_fields_example.patch634 bytespp
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pp’s picture

jhodgdon’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs backport to D7

Thanks! Agreed on the problem and the patch, which should apply fine for D8 and D7.

Note: The problem is that node_get_types() returns an array of objects, so you need to use $obj->type to get the type name to use in the sample function body. An alternate fix would be to call node_type_get_names() instead of node_type_get_types(), I guess, but IMO this patch is fine.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x and 7.x. Thanks!

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