通过服务端点将上下文过滤器参数传递给视图
我创建了一个具有上下文过滤器的视图。然后我创建了一个服务(使用服务模块)来提供视图。例如,假设我的服务名称是搜索,我的视图名称是具有上下文过滤器城市的动物园。以下 url 将返回正确的内容: http://?q=search/views/zoos.json http://?q=zoos/Austin
但是如果我执行以下操作: http://?q=search/views/zoos.json/奥斯汀 我会收到 404 响应。
使用服务时如何将参数传递给视图?我使用 7.10 和 3.1 来处理服务和视图。
我非常感谢您的所有回复。
I created a view that has contextual filter. Then I created a service (using Services module) to serve up views. For example, let's say my service name is search, and my view name is zoos with a contextual filter city. The following url will return the correct contents:
http:/?q=search/views/zoos.json
http:/?q=zoos/Austin
But if I do the following:
http:/?q=search/views/zoos.json/Austin
I will get 404 response.
How do I pass arguements to a view when using service? I'm using 7.10 with 3.1 for Services and Views.
I'd appreciate all of your response.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只能让上下文过滤器处理服务中的“视图”资源。我最初尝试创建一个“服务视图”并将其选择为资源,但也无法让端点注册我的参数。如果作为常规视图恢复并指定 view_id 来完成,它会像魅力一样工作。
这似乎是模块中的一个错误,但我无法花时间来追查它,因为替代方案对我有用。
I was only able to get contextual filters to work on the "views" resource in the service. I originally tried to create a "service view" and sleect it as the resource but wasnt able to get the endpoint to register my arguments either. If done as a a regular views resurce and specifying the view_id it worked like a charm.
THis seems to be a bug in the module but i wasnt able to devote time to chase it down since the alternative worked for me.