You are here

function mediafront_handler_field_player::render in MediaFront 6.2

Same name and namespace in other branches
  1. 6 views/mediafront_handler_field_player.inc \mediafront_handler_field_player::render()
  2. 7 views/mediafront_handler_field_player.inc \mediafront_handler_field_player::render()

File

views/mediafront_handler_field_player.inc, line 162

Class

mediafront_handler_field_player
Field handler to provide simple renderer that turns a URL into a clickable link.

Code

function render($values) {
  $options = array(
    'intro' => $this->options['intro'],
    'commercial' => $this->options['commercial'],
    'prereel' => $this->options['prereel'],
    'media' => $this->options['media'],
    'postreel' => $this->options['postreel'],
    'preview' => $this->options['preview'],
  );
  $node = new stdClass();
  $node->mediafiles = array(
    'media' => array(),
    'images' => array(
      'image' => '',
    ),
  );
  foreach (array_filter($options) as $type => $value) {
    if (isset($this->view->field[$value])) {
      $field = $this->view->field[$value];
      $value = $this
        ->renderField($values, $field);
      if ($type == 'preview') {
        $node->mediafiles['images']['image'] = $value;
      }
      else {
        $node->mediafiles['media'][$type] = $value;
      }
    }
  }
  return theme('mediafront_field', $node, $this->options['preset']);
}