There is a Video content type which have filed type of Kaltura Media.
There is a Media Gallery content type which have reference to Video.

When creating view of Videos additional fields (like duration, thumbnail, etc.) shown properly.
When creating view of Media Galleries + Videos as relathionship, almost all field except of entryId are empty.

In kaltura_views.view.inc I've replaced kaltura_views_handler_field_kaltura_duration to views_handler_filter_numeric and I see that since that data of this field is shown good, however it is unformatted.

    'kaltura_duration' => array(
      'title' => t('kaltura item duration'),
      'help' => t(''),
      'field' => array(
        'handler' => 'kaltura_views_handler_field_kaltura_duration', // I've replaced handler to views_handler_filter_numeric
        'click_sortable' => FALSE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
    ),

I am using views 6.x-3.x-dev.

Comments

dealancer’s picture

Title: When using relationship in views, kaltura fields is not shown » When using relationship in views, kaltura fields are empty

I have mad var_dump of the $data that is passed to kaltura_views_handler_field_kaltura_duration and see that there isn't any node_kaltura_kaltura_duration field.

I have tried to do another way: add node relationship in kaltura_views.view.inc. And then made view using relationship to node_kaltura table.

    // Node ID field.
    'nid' => array(
      'title' => t('kaltura node ID'),
      'help' => t('id of the kaltura node'),
      'relationship' => array(
        'base' => 'node',
        'base field' => 'nid',
        'skip base' => array(),
        'handler' => 'views_handler_relationship',
        'label' => t('kaltura'),
      ),
    ),

In $data i got need field but with with ode_node_kaltura__ prefix:
node_node_kaltura__node_kaltura_kaltura_duration (String, 1 characters ) 5

dealancer’s picture

Title: When using relationship in views, kaltura fields are empty » Theme functions in handlers do not work properly
Priority: Major » Critical
dealancer’s picture

Title: Theme functions in handlers do not work properly » When using relationship in views, kaltura fields are empty
Priority: Critical » Major
dealancer’s picture

Title: When using relationship in views, kaltura fields are empty » Theme functions in handlers do not work properly
Priority: Major » Critical

For the view views_handler_field some another approach for themining is used:

See http://api.freestylesystems.co.uk/api/drupal/contributions--views--handl... and http://api.freestylesystems.co.uk/api/drupal/contributions--views--theme...

 /**
   * Call out to the theme() function, which probably just calls render() but
   * allows sites to override output fairly easily.
   */
  function theme($values) {
    return theme($this->theme_functions(), $this->view, $this, $values);
  }

  function theme_functions() {
    $themes = array();
    $hook = 'views_view_field';

    $display = $this->view->display[$this->view->current_display];

    if (!empty($display)) {
      $themes[] = $hook . '__' . $this->view->name  . '__' . $display->id . '__' . $this->options['id'];
      $themes[] = $hook . '__' . $this->view->name  . '__' . $display->id;
      $themes[] = $hook . '__' . $display->id . '__' . $this->options['id'];
      $themes[] = $hook . '__' . $display->id;
      if ($display->id != $display->display_plugin) {
        $themes[] = $hook . '__' . $this->view->name  . '__' . $display->display_plugin . '__' . $this->options['id'];
        $themes[] = $hook . '__' . $this->view->name  . '__' . $display->display_plugin;
        $themes[] = $hook . '__' . $display->display_plugin . '__' . $this->options['id'];
        $themes[] = $hook . '__' . $display->display_plugin;
      }
    }
    $themes[] = $hook . '__' . $this->view->name . '__' . $this->options['id'];
    $themes[] = $hook . '__' . $this->view->name;
    $themes[] = $hook . '__' . $this->options['id'];
    $themes[] = $hook;

    return $themes;
  }
}
function theme_views_view_field($view, $field, $row) {
  // Reference safe for PHP 4:
  return $view->field[$field->options['id']]->advanced_render($row);
}

So I think theming functions here should to be remade. Changing status and title of the issue.

xurizaemon’s picture

Status: Active » Needs work

Definitely, the existing theme layer of this module is pretty poor form.

Duplicate of #685900: Use theme & translation layers & FAPI. Patches welcome!