Answer the question
In order to leave comments, you need to log in
Drupal. How to display a field from file_managed table?
Guys, hello everyone. Tell me please. In the file_managed Drupala table, I introduced a new field - hash. Varchar. After that I want to display the value of this field in $content. In block.module, I found the template_preprocess_block function, which gives content with additional fields as links for downloading files attached to the content. Var_dump dumps all the fields of the file_managed table, but without my last hash field. I hope the question is clear .. you need to display the value of the hash field
Answer the question
In order to leave comments, you need to log in
It was necessary to use the File Entity module, which allows you to connect fields to the File, then you could show / change anywhere through the UI.
Now you will have to pull out the hash through the code (since $content - you want to show it in the node):
// Узнаем fid
$fid = $node->field_image[$node->language][0]['fid'];
// Получаем hash
$hash = db_query("SELECT hash FROM {file_managed} WHERE fid = :fid", array(':fid' => $fid))->fetchField();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question