欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

在 Drupal 7 中 使用实体引用视图 有大用 有大大用 有大大大用

要新建一个实体引用 见  /node-admin/16794

要在文本框下 自动完成   设置如下几个字段

image.png



 在某个字段下使用实体引用  

1)  Autocomplete tags styleimage.png


2)

image.png


这个 实体字段在页面上显示

image.png



这个 实体字段在页面上显示 (覆写 (超越)默认的输出)

第一步

image.png

第二步,在主题的 template.php中

function bartik_clone_entityreference_entity_id($vars) {
 global $user;
 if($user->uid==1){
   $settings = $vars['settings'];
   $item = $vars['item'];

   $output = '';
   $output .= $item['entity']->field_full_name['und'][0]['safe_value'].' - '.$item->entity->name.' ('.$item['target_id'].')';
   return $output;
 }
}


普通分类: