How do I get a field label by the field name in drupal ?
The label is set per instance (not per field) so you would use the field_info_instance()
function with some appropriate arguments:
$entity_type = 'node';
$bundle_name = 'article';
$field_name = 'field_some_field';
$info = field_info_instance($entity_type, $field_name, $bundle_name);
$label = $info['label'];
There’s a bunch of other useful functions in the Field Info API documentation that might be helpful in case you haven’t seen it already.
Comments...
No comments found. Leave your reply here.