I'm pretty sure I am not doing anything incorrect, but whenever I added "Content:Path" the Services View does not recognize it. It doesn't add it to the array.
In my page view it shows up, but the Service View doesn't.

Comments

sayembd’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev

Similar thing happens when I add "Content:Thumbnail"!

acrosman’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

I'm still seeing this issue in the lastest dev release (from 4/29/2013).

nravens’s picture

I have the same issue. Can't add a path or link to the nodes of XML feeds. Makes the feed useless in my case. I can't even get absolute URLs for category fields...

Is their another way to add node url's to xml output via services/services_views and views?

leewillis77’s picture

Confirmed here with 7.x-1.0-beta2

mp165’s picture

same issue here.

mp165’s picture

i just realized that i can get the path (and other fields) to show up using the views resource (which seems to use the master display) rather than the resource path set up when i add a services display in the view itself. not sure why it doesn't work in both situations though.

marcus178’s picture

I have the same problem, all fields show when using the views resource by not when using the resource generated by this module.

areynolds’s picture

Issue summary: View changes

Confirming this issue as well.

Relevant code is in views_plugin_display_services.inc in this foreach loop which maps field labels to their values in the View to be output:

$result = array();
    foreach ($this->view->result as $item) {
      $new_item = new stdClass();
      foreach ($this->view->field as $field) {
        if (isset($item->{$field->field_alias})) {
          // Make sure new keys are alphanumerical, underscore and dash.
          if (!empty($field->options['label']) && preg_match('/^[0-9a-z_-]*$/', $field->options['label'])) {
            $new_item->{$field->options['label']} = $item->{$field->field_alias};
          }
          else {
            $new_item->{$field->field_alias} = $item->{$field->field_alias};
          }
        }
      }
      if (!empty($new_item)) {
        $result[] = $new_item;
      }
    }

    return $result;

The problem is that path fields don't have a field_alias, so "isset($item->{$field->field_alias}" fails.

I'm **guessing** there's a more abstract way to do this using other code in cTools or Views. It could be that architecturally we should be doing this rendering in a style plugin instead of a display. Hoping someone else has a bit of input on these matters?

areynolds’s picture

This is NOT a good patch, this is a quick fix that I just implemented to get around this issue; might help someone until we can get some better feedback on this problem.

areynolds’s picture

StatusFileSize
new1.88 KB

Further reinforcing how bad this patch is, a quickly re-rolled version.

derekwebb1’s picture

This is still a problem! -_-

Maybe I should just create a menu callback to return views data - bypass services views altogether. This module has had me pulling my hair for days now. And there is no end in sight. Would definitely not recommend!

Patch in #10 seems to work to get paths to show again (I say again since I saw them right after I first set up this module - using the views resource; not the generated (per-view resources)

kylebrowning’s picture

kylebrowning’s picture

Status: Active » Closed (duplicate)