1

The syntax to create fields is on https://drushcommands.com/drush-8x/field/field-create/

For those it works:

Images:

drush field-create article img,image,image_image

Text fields:

drush field-create user address,text,text_textfield --entity_type=user

text long:

drush field-create user address,text_long,text_textarea --entity_type=user

Decimal:

drush field-create user userpoints,number_decimal,number_textfield --entity_type=user

Boolean:

drush field-create content haspurchase,list_boolean

Is there a way to create a select list field pre-filled with values?

2

You can create select field also from drush command. Just type the command from drupal root directory drush field-create content_type_name and hit enter key and follow the instruction. Please see the attached screenshot.

enter image description here

Copy the last output which is edit url of your field where you can refinement your field.

  • Thanks Yogesh. Can you give an example how to pre-fill the field name_class (e.g. with samurai, ninja, sake)? I was able to create the field, but is there a way to pre-populate it using Drush? The idea is that the user enters some information (in this case fields of an object) in a webform and the result is drush code – user24957 May 29 '17 at 9:57
  • There is nothing about option creation in the documentation of drush field-create command. You can check here drushcommands.com/drush-7x/field/field-create This is only what this command provide. – Yogesh Kushwaha May 29 '17 at 10:13
  • i see. thanks. i guess than its not doable without customisation – user24957 May 29 '17 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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