Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Node type is object. Use $bundle->type instead of $bundle
http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...
Comment | File | Size | Author |
---|---|---|---|
hook_field_extra_fields_example.patch | 634 bytes | pp | |
Comments
Comment #1
pp CreditAttribution: pp commentedsee pathauto module:
http://drupalcontrib.org/api/drupal/contributions--pathauto--pathauto.mo...
Comment #2
jhodgdonThanks! 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.
Comment #3
webchickCommitted and pushed to 8.x and 7.x. Thanks!