Problem/Motivation

Enhancing the form UX of Field Value Revisions often requires information about the widget type of fields it affects, not only the field name.

Proposed resolution

Add a helper method to the Settings service.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

mlncn created an issue. See original summary.

mlncn’s picture

Status: Active » Needs review
> $fields = \Drupal::service('value_revisions.settings')->fieldsInfo($entity);
= [
   "title" => [
     "field_type" => "string",
     "widget_type" => "string_textfield",
   ],
   "field_addresses" => [
     "field_type" => "entity_reference",
     "widget_type" => "inline_entity_form_complex",
   ],
   "field_aka" => [
     "field_type" => "string",
     "widget_type" => "string_textfield",
   ],
   "field_alternate_names" => [
     "field_type" => "string",
     "widget_type" => "string_textfield",
   ],
   "field_email_addresses" => [
     "field_type" => "email",
     "widget_type" => "email_default",
   ],
   "field_industries" => [
     "field_type" => "list_string",
     "widget_type" => "options_buttons",
   ],
   "field_naics_codes" => [
     "field_type" => "string",
     "widget_type" => "string_textfield",
   ],
   "field_phone_numbers" => [
     "field_type" => "telephone",
     "widget_type" => "telephone_default",
   ],
   "field_related_actors" => [
     "field_type" => "entity_reference",
     "widget_type" => "entity_reference_autocomplete",
   ],
   "field_tags" => [
     "field_type" => "entity_reference",
     "widget_type" => "",
   ],
   "field_visas" => [
     "field_type" => "entity_reference",
     "widget_type" => "entity_reference_autocomplete",
   ],
   "field_websites" => [
     "field_type" => "link",
     "widget_type" => "link_default",
   ],
 ]

When a widget is blank, as in this example for tags, that is because at some point after configuring Value Revisions for the field, the decision was made not to show the field on the form.

hongpong’s picture

Status: Needs review » Fixed

well this worked great anyway. call it fixed imo. well done.

mlncn’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.