Last updated 4 February 2015. Created on 4 February 2015.
Edited by xcf33. Log in to edit this page.

The NetX integration module contains 2 ways to display metadata associated with each asset.

1. Using the views integration to create a view that pulls in the Asset Meta Data
2. Use template preprocess and template.php to display those attributes.

Let's look at method #2:

NetX Metadata is generally stored in Drupal's file_entity object.

For example, in a devel tab for a file or when you use

$fid = 1;
$file = file_load($fid);

You should be able load a file entity. For NetX files, there are 2 array element in the $file->metadata property:


Each above array is an index array that contains either the name of the asset attributes configured on NetX or the values of these attributes. In order to display them in the node display, you could do the following:

// In template.php in your theme

 * Implements THEME_preprocess_node().
function my_theme_preprocess_node(&$variables) {
     $node = $variables['node'];
     $lang = $node->language;
     // Name of the file field for media asset
     if (!empty($node->field_netx_asset)) {
          $file = file_load($node->field_netx_asset[$lang][0]['fid']);
          $attributes = array();
          foreach ($file->metadata['attributeNames'] as $key => $name) {
               $attributes[] = array($name, $file->metadata['attributeValues'][$key]);
     if (!empty($attributes)) {
          $variables['file_metadata'] = theme('table', array('header' => array('Attribute', 'Value'), 'rows' => $attributes));

The above code snippet makes a number of assumptions such as not checking content type in which the field is configured or iterating through multiple field values if configured so. It is only for demonstration purposes.

// In your node.tpl.php (Or similar, see theming guide)
// Place the metadata table in a desired place

  if ($file_metadata) {
      print $file_metadata;

The above example would print a table that looks like the following

Attribute | Value
[Attribute 1] | [Value1]
[Attribute 2] | [Value2]
[Attribute 3] | [Value3]

Looking for support? Visit the forums, or join #drupal-support in IRC.