0

I have been exploring Drupal 8 and it's tables lately. The config table has the storage information serialized as blob. But it doesn't store the Label or Description of a field. Where can one find these data? Is there a core function which helps in fetching all these data for a particular content type?

1
  • As basically everything is an entity (content + configuration) core's entity api offers everything you need to fetch the data you are interested in.
    – theuni
    Commented Apr 10, 2018 at 12:15

1 Answer 1

1

You can try something like this :-

$node = \Drupal::routeMatch()->getParameter('node');
if ($node) {
$field_label = $node->field_file->getFieldDefinition()->getLabel();
$field_desc = $node->field_file->getFieldDefinition()->getDescription();
$field_settings = $node->field_file->getFieldDefinition()->getSettings();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.