简体   繁体   English

在 URL 中发送视图字段 - Drupal

[英]Send view field in URL - Drupal

I have a search page created with embedded filters in Drupal 8 View.我在 Drupal 8 View 中有一个使用嵌入式过滤器创建的搜索页面。 In the list of fields I have a fields - [Field_program_id].在字段列表中,我有一个字段 - [Field_program_id]。 I also have a button 'Learn more' when clicking this button I want to pass the [field_program_id] and show the details of the Programs in that page.单击此按钮时,我还有一个“了解更多”按钮,我想传递 [field_program_id] 并在该页面中显示程序的详细信息。 Not sure where to start.不知道从哪里开始。 Any guidance?!有什么指导吗?!

My view looks as below:我的观点如下:

在此处输入图片说明

The '968' is the Program ID. '968' 是程序 ID。 Upon clicking the learn more, I want my url to be https://myproj/search?nodeid=[field_program_id]单击了解更多信息后,我希望我的网址为https://myproj/search?nodeid=[field_program_id]

and in this page I want to show the details again.在此页面中,我想再次显示详细信息。 Any help?!有什么帮助吗?!

I did something similar to this.我做了类似的事情。

Have the view render fields, and add a field type of "Custom text".让视图呈现字段,并添加“自定义文本”字段类型。

Under "configure field", expand 'Rewrite results', and check, "Output this field as a custom link".在“配置字段”下,展开“重写结果”,然后选中“将此字段输出为自定义链接”。

You can use replacement patterns to get the ID you need into the url.您可以使用替换模式将所需的 ID 获取到 url 中。

For example, set the link path to "/search?nodeid={{nid}}"例如设置链接路径为“/search?nodeid={{nid}}”

That should render the link you need.这应该呈现您需要的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM