When I add a new field_collection item in a content typ, the title is like "Add FIELD_COLLECTION_FIELD_LABEL_NAME". I have to set additional information for the add, edit and delete title. For this case I have altered the label calback for field_collections:
/**
* Implements hook_entity_info_alter().
*/
function my_module_entity_info_alter(&$entity_info) {
// Change the label callback for field collection to provide a better label name
if (isset($entity_info['field_collection_item'])) {
$entity_info['field_collection_item']['label callback'] = 'my_module_content_field_collection_label';
}
}
This works great for edit and delete but not for add, because add does not use the $entity->label() function to generate the "Add ..." text and the defined label callback is not invoked.
Comments
Comment #1
weri commentedI created a patch for that.
Comment #3
weri commentedI forgot to change the file paths.
Comment #5
weri commentedComment #6
jmuzz commentedComment #7
damienmckennaNeeds to be reviewed against the latest -dev release.