简体   繁体   English

用户资料中的Drupal 7实体参考

[英]Drupal 7 Entity Reference in User Profile

I have a Client content type with an Image field named Logo. 我有一个客户端内容类型,其图像字段名为Logo。

Client - Image: Logo 客户-图片:徽标

I also have a User profile with an Entity Reference field name Featured Clients. 我也有一个用户配置文件,其中的“实体引用”字段名称为“特色客户”。

User - Entity Reference 用户-实体参考

How do I create a View that will show the Client Image Logo of the Client Node referenced in the User profile? 如何创建一个视图,以显示用户配置文件中引用的客户端节点的客户端图像徽标?

Scenario: 场景:

User (example) - Entity reference for this 'example' user references Client node #1. 用户(示例)-此“示例”用户的实体引用引用客户端节点1。

I want the image logo of that Client node #1 to show up in the User 'example' profile. 我希望该“客户端”节点1的图像徽标显示在“用户”示例配置文件中。

Hope that makes sense. 希望有道理。 I've been researching Contextual Filters and Entity References in Drupal 7, but I haven't found the right solution yet. 我一直在Drupal 7中研究上下文过滤器和实体引用,但是我还没有找到正确的解决方案。

I figured it out. 我想到了。

When creating a View, under Relationships I selected the following: 创建视图时,在“关系”下选择以下内容:

  • Profile referencing Content from field_some_featured_clients 配置文件引用来自field_some_featured_clients的内容
  • Require this Relationship is Checked 要求检查此关系

Under Contextual Filters, I selected the following: 在上下文过滤器下,我选择了以下内容:

  • User ID 用户身份
  • Specify Validation Criteria >> User >> Allow both User IDs and string usernames 指定验证条件>>用户>>同时允许用户ID和字符串用户名
  • When filter NOT available >> Provide Default Value >> User ID from URL 如果过滤器不可用>>提供默认值>> URL中的用户ID

Under Fields, I selected the following: 在字段下,我选择了以下内容:

  • Content: Logo 内容:徽标

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

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