在 drupal 7 中使用视图服务选择语言
Choose language using views services in drupal 7
我将视图服务模块与休息服务一起使用。视图使用 "current user's language" 显示内容,但当我获取内容时,总是 returns 使用默认语言。
例如:
http://example.com/api1_rest/views/content_view?id_display=page&limit=10&offset=0
Returns
[
{
"vid":"300",
"uid":"4",
"title":"node title",
"log":"",
"status":"1",
"comment":"0",
"promote":"0",
"sticky":"0",
"nid":"2488",
"type":"news",
"language":"en",
"revision_timestamp":"1422900078",
"revision_uid":"1",
"body":{
"en":[
{
"value":"content body here",
"summary":"",
"format":"4"
}
]
},
}
]
我需要在申请中选择语言。
来自 Services Views module page:
You can create exposed filters and pass them to your resource. For example if we created exposed filter "tags" call will be:
http://example.com//?tags=7
因此,您可以在视图中为语言创建公开过滤器,而不仅仅是通过将 &lang=en 添加到 url:
来过滤结果
http://example.com/api1_rest/views/content_view?id_display=page&limit=10&offset=0&lang=en
我将视图服务模块与休息服务一起使用。视图使用 "current user's language" 显示内容,但当我获取内容时,总是 returns 使用默认语言。
例如:
http://example.com/api1_rest/views/content_view?id_display=page&limit=10&offset=0
Returns
[
{
"vid":"300",
"uid":"4",
"title":"node title",
"log":"",
"status":"1",
"comment":"0",
"promote":"0",
"sticky":"0",
"nid":"2488",
"type":"news",
"language":"en",
"revision_timestamp":"1422900078",
"revision_uid":"1",
"body":{
"en":[
{
"value":"content body here",
"summary":"",
"format":"4"
}
]
},
}
]
我需要在申请中选择语言。
来自 Services Views module page:
You can create exposed filters and pass them to your resource. For example if we created exposed filter "tags" call will be: http://example.com//?tags=7
因此,您可以在视图中为语言创建公开过滤器,而不仅仅是通过将 &lang=en 添加到 url:
来过滤结果http://example.com/api1_rest/views/content_view?id_display=page&limit=10&offset=0&lang=en