You are here

function _mediafront_get_field in MediaFront 6

Same name and namespace in other branches
  1. 6.2 mediafront.module \_mediafront_get_field()
  2. 7 mediafront.module \_mediafront_get_field()

Returns the field if it exists.

1 call to _mediafront_get_field()
mediafront_playlist_node in ./mediafront.module
Implementation of hook_playlist_node()

File

./mediafront.module, line 819

Code

function _mediafront_get_field($node, $field_name, $index = -1) {
  if (isset($node->{$field_name}) && is_array($node->{$field_name}) && isset($node->{$field_name}[0]) && is_array($node->{$field_name}[0])) {
    return $index >= 0 ? $node->{$field_name}[$index] : $node->{$field_name};
  }
  else {
    return null;
  }
}