Problem/Motivation
In scenarios where the entity has been populated and the data for a field is presented read-only in the form, it could be useful to allow for configurable empty text on the widget configuration.
In an example scenario, we are populating entities through Migrate. Those entities will then be reviewed in edit mode, where some data is allowed to be modified directly, and in other cases we display the migrated data as read-only and ask the person reviewing the entity if that data is correct. In instances where no data was migrated for a field it would be useful to display a message such as "This field is empty." or "No data present", etc.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | readonly_field_widget-third-party-settings-3220671-mr-1-reroll.patch | 8.77 KB | rigoucr |
| #8 | third-party-settings-3220671-8.patch | 7.59 KB | pookmish |
Issue fork readonly_field_widget-3220671
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
thtas commentedPerhaps this will work in conjunction with the https://www.drupal.org/project/empty_fields module?
Comment #4
jerdavisEmpty Fields works on field formatters, not field widgets. Just as I need this module to render the field widget (input) as read-only, I need it to also have functionality to display a message when that field is empty. The field formatter renders the output of the field on the view of an entity, rather than the form mode.
Comment #5
thtas commentedThis module uses the field formatters as options to display in the widget mode, so I was hoping the empty field module options might be available without too many changes to this module, but it sounds like it might need some integration work.
Comment #6
thtas commentedIn order for this module to work with the Empty Fields module, it first needs support for field formatter third party settings.
Attached is a patch to bring in such support in a general way.
However, because of the way the Empty Fields AJAX forms make assumptions about the structure form state it will need patches or perhaps some other workaround before it will work with this module.
Todo:
- Add some test coverage to ensure that third party settings work as expected in a simple example (partially done)
- Investigate patching Empty Fields so that their third party settings ajax forms work with the patch attached here.
Comment #7
thtas commentedComment #8
pookmish commentedRe-rolling patch from #6 for latest 1.6.0 version. I'll create a MR as well.
Comment #12
rigoucrpatch reroll for version 2.xI made a mistake and provide the wrong patch
Comment #13
rigoucrComment #14
rigoucrNow providing the right patch reroll for the MR 1, sorry about the other one.
Comment #15
astonvictor commentedComment #17
astonvictor commented