In core/modules/field/field.api.php there's a mistake in hook_field_extra_fields_alter() example. A key level is missed (['form'] or ['display']).
The function should be:
/**
* Alter "pseudo-field" components on fieldable entities.
*
* @param $info
* The associative array of 'pseudo-field' components.
*
* @see hook_field_extra_fields()
*/
function hook_field_extra_fields_alter(&$info) {
// Force node title to always be at the top of the list by default.
foreach (node_type_get_types() as $bundle) {
if (isset($info['node'][$bundle->type]['form']['title'])) {
$info['node'][$bundle->type]['form']['title']['weight'] = -20;
}
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | extra-fields-1333346-5.patch | 1 KB | claudiu.cristea |
| #1 | extra-fields-1333346-1.patch | 1.03 KB | claudiu.cristea |
Comments
Comment #1
claudiu.cristeaAttached a patch.
Comment #2
claudiu.cristeaComment #3
yched commentedThat's correct. Thanks !
Comment #4
catchThanks!
Committed/pushed to 8.x. Will need a re-roll for 7.x
Comment #5
claudiu.cristeaPatch for 7.x.
Comment #6
yched commentedComment #7
webchickNice catch! Committed and pushed to 7.x. Thanks!