Drupal8: Finding All FieldWidget Types

16th February 2020

Whilst searching for an answer to a problem the other day I found a comment that details a command that prints out all of the FieldWidgets available in Drupal 8. This is useful if you are looking for all of the field widget classes in Drupal8.

Here is the command:

grep -rl '\@FieldWidget' | xargs grep -m1 'id = ' | grep -o FieldWidget.*

This prints out something similar to the following:

  1. FieldWidget/TimestampDatetimeWidget.php: * id = "datetime_timestamp",
  2. FieldWidget/EmailDefaultWidget.php: * id = "email_default",
  3. FieldWidget/OptionsSelectWidget.php: * id = "options_select",
  4. FieldWidget/StringTextareaWidget.php: * id = "string_textarea",
  5. FieldWidget/UriWidget.php: * id = "uri",
  6. FieldWidget/StringTextfieldWidget.php: * id = "string_textfield",
  7. FieldWidget/LanguageSelectWidget.php: * id = "language_select",
  8. FieldWidget/NumberWidget.php: * id = "number",
  9. FieldWidget/BooleanCheckboxWidget.php: * id = "boolean_checkbox",
  10. FieldWidget/EntityReferenceAutocompleteWidget.php: * id = "entity_reference_autocomplete",
  11. FieldWidget/OptionsButtonsWidget.php: * id = "options_buttons",
  12. FieldWidget/EntityReferenceAutocompleteTagsWidget.php: * id = "entity_reference_autocomplete_tags",
  13. FieldWidget/LayoutBuilderWidget.php: * id = "layout_builder_widget",
  14. FieldWidget/ModerationStateWidget.php: * id = "moderation_state_default",
  15. FieldWidget/DateRangeDatelistWidget.php: * id = "daterange_datelist",
  16. FieldWidget/DateRangeDefaultWidget.php: * id = "daterange_default",
  17. FieldWidget/FileWidget.php: * id = "file_generic",
  18. FieldWidget/DateTimeDatelistWidget.php: * id = "datetime_datelist",
  19. FieldWidget/DateTimeDefaultWidget.php: * id = "datetime_default",
  20. FieldWidget/CommentWidget.php: * id = "comment_default",
  21. FieldWidget/PathWidget.php: * id = "path",
  22. FieldWidget/TestTextfieldWidget.php: * id = "field_plugins_test_text_widget",
  23. FieldWidget/TestFieldWidget.php: * id = "test_field_widget",
  24. FieldWidget/TestFieldWidgetMultipleSingleValues.php: * id = "test_field_widget_multiple_single_value",
  25. FieldWidget/TestFieldWidgetMultiple.php: * id = "test_field_widget_multiple",
  26. FieldWidget/TestFieldWidgetMultilingual.php: * id = "test_field_widget_multilingual",
  27. FieldWidget/DummyAjaxWidget.php: * id = "image_module_test_dummy_ajax_widget",
  28. FieldWidget/ImageWidget.php: * id = "image_image",
  29. FieldWidget/TelephoneDefaultWidget.php: * id = "telephone_default",
  30. FieldWidget/ShapeOnlyColorEditableWidget.php: * id = "shape_only_color_editable_widget",
  31. FieldWidget/LinkWidget.php: * id = "link_default",
  32. FieldWidget/MediaLibraryInceptionWidget.php: * id = "media_library_inception_widget",
  33. FieldWidget/MediaLibraryWidget.php: * id = "media_library_widget",
  34. FieldWidget/TextareaWithSummaryWidget.php: * id = "text_textarea_with_summary",
  35. FieldWidget/TextfieldWidget.php: * id = "text_textfield",
  36. FieldWidget/TextareaWidget.php: * id = "text_textarea",
  37. FieldWidget/OEmbedWidget.php: * id = "oembed_textfield",
  38. FieldWidget/ViewsReferenceSelectWidget.php: * id = "viewsreference_select",
  39. FieldWidget/ViewsReferenceWidget.php: * id = "viewsreference_autocomplete",
  40. FieldWidget/EntityReferenceBrowserWidget.php: * id = "entity_browser_entity_reference",
  41. FieldWidget/FileBrowserWidget.php: * id = "entity_browser_file",
  42. FieldWidget/MetatagFirehose.php: * id = "metatag_firehose",
  43. FieldWidget/RedirectSourceWidget.php: * id = "redirect_source",
  44. FieldWidget/PanelizerWidget.php: * id = "panelizer",
  45. FieldWidget/ImageCropWidget.php: * id = "image_widget_crop",
  46. FieldWidget/EntityReferenceRevisionsAutocompleteWidget.php: * id = "entity_reference_revisions_autocomplete",
  47. FieldWidget/InlineParagraphsWidget.php: * id = "entity_reference_paragraphs",
  48. FieldWidget/ParagraphsWidget.php: * id = "paragraphs",
  49. FieldWidget/VideoTextfield.php: * id = "video_embed_field_textfield",
  50. FieldWidget/InlineEntityFormComplex.php: * id = "inline_entity_form_complex",
  51. FieldWidget/InlineEntityFormSimple.php: * id = "inline_entity_form_simple",

In osx the command is slightly different, but prints the same result.

grep -rl '\@FieldWidget' * | xargs grep -0 ' id = ' | grep -oE 'FieldWidget.*'

 

Add new comment

The content of this field is kept private and will not be shown publicly.