Avatar Ran Qiangjun

Build compound fields with drush generate field

Submitted by jungle on Tue, 09/17/2019 - 09:13
  1. $ drush generate field
  2.  
  3. Welcome to field generator!
  4. –––––––––––––––––––––––––––––
  5.  
  6. Module machine name:
  7. ➤ recipe
  8.  
  9. Field label [Example]:
  10. ➤ Ingredients
  11.  
  12. Field ID [recipe_ingredients]:
  13.  
  14. How many sub-fields would you like to create? [3]:
  15. ➤ 3
  16. –––––––––––––––––––––––––––––––––––––––––––––––––––
  17.  
  18. Label for sub-field #1 [Value 1]:
  19. ➤ Quantity
  20.  
  21. Machine name for sub-field #1 [quantity]:
  22.  
  23. Type of sub-field #1 [Text]:
  24. [1 ] Boolean
  25. [2 ] Text
  26. [3 ] Text (long)
  27. [4 ] Integer
  28. [5 ] Float
  29. [6 ] Numeric
  30. [7 ] Email
  31. [8 ] Telephone
  32. [9 ] Url
  33. [10] Date
  34. ➤➤➤ 6
  35.  
  36. Limit allowed values for sub-field #1? [No]:
  37.  
  38. Make sub-field #1 required? [No]:
  39. ➤ Yes
  40. –––––––––––––––––––––––––––––––––––––––––––––––––––
  41.  
  42. Label for sub-field #2 [Value 2]:
  43. ➤ Unit
  44.  
  45. Machine name for sub-field #2 [unit]:
  46.  
  47. Type of sub-field #2 [Text]:
  48. [1 ] Boolean
  49. [2 ] Text
  50. [3 ] Text (long)
  51. [4 ] Integer
  52. [5 ] Float
  53. [6 ] Numeric
  54. [7 ] Email
  55. [8 ] Telephone
  56. [9 ] Url
  57. [10] Date
  58. ➤➤➤ 2
  59.  
  60. Limit allowed values for sub-field #2? [No]:
  61. ➤ No
  62.  
  63. Make sub-field #2 required? [No]:
  64. –––––––––––––––––––––––––––––––––––––––––––––––––––
  65.  
  66. Label for sub-field #3 [Value 3]:
  67. ➤ Name
  68.  
  69. Machine name for sub-field #3 [name]:
  70.  
  71. Type of sub-field #3 [Text]:
  72. [1 ] Boolean
  73. [2 ] Text
  74. [3 ] Text (long)
  75. [4 ] Integer
  76. [5 ] Float
  77. [6 ] Numeric
  78. [7 ] Email
  79. [8 ] Telephone
  80. [9 ] Url
  81. [10] Date
  82. ➤➤➤ 2
  83.  
  84. Limit allowed values for sub-field #3? [No]:
  85.  
  86. Make sub-field #3 required? [No]:
  87. ➤ Yes
  88. –––––––––––––––––––––––––––––––––––––––––––––––––––
  89.  
  90. Would you like to create field storage settings form? [No]:
  91.  
  92. Would you like to create field instance settings form? [No]:
  93.  
  94. Would you like to create field widget settings form? [No]:
  95.  
  96. Would you like to create field formatter settings form? [No]:
  97.  
  98. Would you like to create table formatter? [No]:
  99.  
  100.  
  101. The following directories and files have been created or updated:
  102. –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
  103. • modules/recipe/config/schema/recipe.schema.yml
  104. • modules/recipe/css/recipe-ingredients-widget.css
  105. • modules/recipe/src/Plugin/Field/FieldFormatter/IngredientsDefaultFormatter.php
  106. • modules/recipe/src/Plugin/Field/FieldType/IngredientsItem.php
  107. • modules/recipe/src/Plugin/Field/FieldWidget/IngredientsWidget.php
  108. • modules/recipe/recipe.libraries.yml

See https://www.drupal.org/project/ideas/issues/607396#comment-13260425

©2019 ranqiangjun.com. All rights reserved.