0

I want to make a field with type file and this field with multiple values, so far I know that its simply possible but I want also to some thing like bundle field with each file uploaded and this field is representing language.

Example: Suppose I upload 3 files in same field for the same node & each file with different language (file_1 => English , file_2 => French , file_3 => German) and so on.

So is there any module can accomplish that, or its something I should do custom?

I want a solution like the attached image enter image description here

1
  • Why not using translated node for each language? The file field is the only difference between the languages?
    – rreiss
    Oct 8, 2015 at 21:55

6 Answers 6

1

Are you looking for field_collection?

  1. Install and enable the module.
  2. Add a field of type "Field Collection" to your entity type.
  3. Go to admin->structure->Field COllection
  4. Add 2 fields 1 field is of file type 2 field is either select box with countries or can be taxonomy reference field

Now while creating the content, you will have option to upload a file and select a language for it.

1
  • probably this might do the job, i ll try it and will come back with the result. Oct 21, 2015 at 13:03
0

The Entity translation module should allow you to accomplish this.

A brief series of steps to are listed below but I would encourage you to look at this page on drupal.org

  1. Install and enable the module
  2. Add additional languages to your site
  3. Enable multilingual support for the content type
  4. Make the file field translatable
1
  • i tried the entity translation which is OK, but if there is a module can do as in the attached image it would be the ideal solution for me. Oct 11, 2015 at 23:26
0

You could make custom solution by using delta as the field will have more than one value

0 => English , 1 => French , 3 => German

So when you are viewing that node based on language you could just render each file based on mapping delta with languages.

Also making custom field--[type|name[--content-type]|content-type].tpl.php take a look at to control field display

even with views you could alter the views_query

At the end you have to handle edit and if the user deleted one file you must make the delta be in its original order.

0

with file_entity module you can attach more fields to file widget. So when user uploads something he/she can select language. In your case I think you would need also languagefield or create field inside file entity and populate list of enabled languages.

0

What about Inline Entity Form module (https://www.drupal.org/project/inline_entity_form)

follow the next steps:

  1. Create one content type with the file field. You didn't mention if your site uses multiple languages, if it does most probably the language field would show up in the form (with the languages that the site is using). If there is not a default language field you can add a language taxonomy containing the desired languages.
  2. On your current form add an entity reference field pointing to the form with the file file, and select inline entity form(multiple values) widget.

Then you can use Views to display your info. Or if you don't want to use views then you can use Inline Entity Display module (https://www.drupal.org/project/inline_entity_display)

0

I think multifield is the most close solution to what i need

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.