开发者

Two part CCK field

开发者 https://www.devze.com 2023-02-07 19:01 出处:网络
Is there a way to add one CCK field which consists of two separate fields, e.g. Author(s), having first name and last name on separate fields?

Is there a way to add one CCK field which consists of two separate fields, e.g. Author(s), having first name and last name on separate fields?

Thanks for开发者_如何学编程 any help!


Show answer: not easily.

Long answer: yes, but with a bit of php trickery.

Look at this doc here, specifically, the lower "join" part will get you on the right track, but its specifically for 5.x. If you are working on 7.x this would be quite a bit different.


You can use CCK 3.x for Drupal 6, which contains a sub-module called Multigroup, which allows you to take groups of fields (first name, last name for example), and repeat those groupings. However, before using this version of the module, note that it does not have an officially supported release, and its future is a bit uncertain.


In addition to other suggestions, you could try Flexifield, or just have two different fields.

To make two fields end up looking like one...

  1. display them together later on using inline fields or by altering the template
  2. use Actions to join the two values together and save them to a different field, or
  3. use Computed Field to write them to another field on node save

Content Multigroup in CCK3 currently has no upgrade path to Drupal 7 and its interface is a bit clunky if you aren't planning on having a multi-value, multipart field.

0

精彩评论

暂无评论...
验证码 换一张
取 消