Issue
I want to add a 'None (hidden)' field-widget to core to simplify the common case of hiding them.
Why
It's not unusual that I have to hide fields of an entity because the fields value comes by eg. Rules, code etc.
But whereever it comes from, everytime the same shi*: implement a hook_form_alter .. that sucks.
And whenever I asked the question: Why is there not a "hidden widget" in core?
I get: There are simply not enough use-cases for that.
If I spend 10 minutes of searching around...
http://drupal.org/node/187945
https://drupal.org/node/468500
https://drupal.org/node/728398
[... https://encrypted.google.com/search?q=+site:drupal.org+drupal+hide+a+fie...
or even more outsite d.o:
http://google.com/search?q=drupal%20hide%20form%20elements
modules trying to clear this gap..
https://drupal.org/project/hidden_widget
https://drupal.org/project/field_extrawidgets
https://drupal.org/project/field_hidden
https://drupal.org/project/hidden_field
https://drupal.org/project/formfilter
[... probably more I could not find]
I think it's obvious that there is a need for this.
Comment | File | Size | Author |
---|---|---|---|
#91 | 1465774-D7-field-hidden-widget-91.patch | 3.48 KB | jpstrikesback |
#88 | 1465774-D7-field-hidden-widget-88.patch | 3.49 KB | jpstrikesback |
#85 | 1465774-D7-field_hidden-widget-86.patch | 3.49 KB | jpstrikesback |
#84 | field_hidden-widget.patch | 3.53 KB | jpstrikesback |
#67 | hidden_widget-1465774-67.patch | 8.2 KB | amateescu |
Comments
Comment #1
patrickd CreditAttribution: patrickd commentedThis is a start - but probably not the best way to do it.
Comment #3
patrickd CreditAttribution: patrickd commented#1: hidden_widget-1465774-1.patch queued for re-testing.
Comment #4
valthebald#3: your patch was not resubmitted for retesting
Comment #5
patrickd CreditAttribution: patrickd commentedas far I can see it was
the patch of #1 failed first, after resubmission in #3 it seems to be green
Comment #6
valthebaldRight, sorry.
I was confused by the fact that resubmitted patch passed testst
Comment #7
sunMakes sense to me.
I'd consider this RTBC, if you convert the hard-coded/custom 'hidden' definition into an actual 'field_hidden' widget plugin that is supplied by Field module itself.
Comment #8
patrickd CreditAttribution: patrickd commentedwill do, thanks
Comment #9
Bojhan CreditAttribution: Bojhan commentedUI impact?
Comment #10
amateescu CreditAttribution: amateescu commentedThe only UI impact of this change should be an extra item in the widgets select list from field UI.
Comment #11
Bojhan CreditAttribution: Bojhan commentedHow is hidden a type though? Its a visibility setting? I don't think loads of people will understand adding a hidden widget?
Comment #12
patrickd CreditAttribution: patrickd commentedwell yes, but It wouldn't make much sense to be able to choose a widget and tick a checkbox to hide it anyway?
We can mark it as "special" value as it is done in some other core selections like "- Hidden -" or "- None -"
Comment #13
amateescu CreditAttribution: amateescu commentedThe Manage Display screen uses
<Hidden>
, I guess we can do the same here :)Comment #14
patrickd CreditAttribution: patrickd commentedThis small patch adds a 'field_hidden' widget (class HiddenWidget) plugin.
Issues I have with this patch:
- Can't use
<Hidden>
because it seems that annotations removes all tags, resulting in an empty select item (how ironic, it's hidden^^)- Only works for core field modules, other field providing modules have to add their self in by altering the "this widget is only for these fields list", that sucks.
I'm not sure whether adding this as plugin really makes much sense, as this is rather a "special case" than a widget.
Comment #15
Bojhan CreditAttribution: Bojhan commentedThis all seems just a side effect, because the "form" is not a view mode :)
Comment #16
sunThanks!
Ugh. I thought Field API would support an "any" field type or similar wildcard flag that disables the field type constraint... :-/
I wonder whether this can be fixed easily or whether we should go back to the first/original patch.
Pinging @yched for that.
P.S.: "- Hidden -" is definitely the correct and proper label for special options (which we should also use in the first patch, in case we go back to that). The
<bracket>
style option labels are stone-age and should be replaced.Comment #17
yched CreditAttribution: yched commentedSeveral things here:
I'm open to finding a way to state that a formatter / widget is applicable to any field type. That would need to be some convention like field_type = array('_any'); in the widget info. (empty array is already taken, it means no applicable field type - that's usually completed in hook_field_widget_info_alter())
Right now, rather than hardcoding all core field types in that list, I'd suggest to keep the array empty in the annotations, and use a hook_field_widget_info_alter() to add all existing field types.
More annoyingly, hiding fields in forms is more complex than hiding fields in displays.
- Hiding a field from the edit form is problematic for required fields. Lets you submit an incorrect entity.
You shouldn't be allowed to use "hidden" widget for required fields - but enforcing that is going to be awkward.
- Just outputting an empty form element is problematic, and there was a back-and-forth dance in D7 around that for fields with field_access('edit') == FALSE:
#636834: Field revision data messed up when user has no 'edit' access on the field
#629252: field_attach_form() should make available all field translations on submit
#822418: Field form structure incomplete if field_access() returns FALSE
In short, if the incoming form values contain no values for the field, this breaks new revision creation IIRC, because the values of the "hidden" field are not reported in the new revision.
Thus, for fields with no field_access('edit'), what we currently do is put the whole widget, with #access = FALSE.
But then, there is the case of "existing field value is 2, then the admin changes the field settings so that min allowed value is 5, then suddenly users without edit perm on this field get a validation error they can't do anything about, because the submitted form values are now incorrect, even though they did not change the field value, and cannot even actually correct it. Stuck".
This was fixed by not reporting field errors on elements where #access = FALSE.
Thus, I'd say the widget should do:
instead of just being empty.
Comment #18
yched CreditAttribution: yched commentedAlso, we should make sure that the 'empty' widget is always last in Field UI's dropdowns.
Support for a 'weight' entry in widget info was added just for this use case in #1586356: Missing 'weight' support from hook_field_widget_info() makes it impossible to sanely order widgets (that was for the "hidden" widget provided by [edit]
@dww's@Damien's http://drupal.org/project/field_extrawidgets)Which, BTW, hints that, since as pointed in the OP, there are many contrib modules trying to fill the need for "hidden widget", it might be a good thing to check how they deal with the issues I pointed in #17.
Comment #19
swentel CreditAttribution: swentel commentedHidden either means
- Using access false so people can't tamper with the data
- Or really having a hidden element because maybe some javascript (or ajax or a submit if javascript/ajax isn't there) is going to add some values form another widget selection
Which one do we choose ? Or do we let people configure this ? Depending on the use case, both are possible.
More over, the usage of the contrib modules is low and there's no effective use case for us in core to use this widget at all. And I also think this is going to confuse the hell out of people - sounds ironic coming from a developer I guess :) I'm personally in favor of keeping this in contrib and otherwise hook_form_alter() is our friend.
Comment #20
catchBumping to task. For user pictures to properly use fields and not be special-cased (i.e. no more variable_get('user_pictures'), we need a way to disable the form element without losing the data, and amateescu pointed out this issue in irc.
Comment #21
swentel CreditAttribution: swentel commentedSo how about adding a 'hidden' region like on the manage display screen ? I've been doing this for years now with Display Suite and potentially opens up 'view modes' on forms. *running away hard now*
Comment #22
Dave ReidNote that typically doing #access = FALSE on file/image fields means this: #1205822: File(s) silently deleted when #access=false.
Comment #23
sunHah. The amount of related issues and monster pitfalls pretty much clarify for me that this should absolutely be figured out by core developers. ;)
@swentel:
I guess a 'hidden' region would basically translate into something very similar to the original patch in #1; i.e., special-casing the 'hidden' widget? I assumed an actual HiddenWidget plugin implementation to be architecturally cleaner, but now with all of those mentioned pitfalls, I could also imagine that a built-in, special handling for widget-less/non-exposed fields might be easier or even required...
It is definitely related to view modes for entity forms, but I'd recommend to not make that a dependency, since the two things don't really seem to be bound to each other.
Comment #24
yched CreditAttribution: yched commentedThe thing is that "hidden" on display just means "nothing to do" - so, no formatter = no code fires, fine.
"hidden" on form means "there is some minimal legwork to do, which basically is WidgetBase::form()" (this method also takes care of prefilling default values on entity creation form, which is something we do for fields with access = FALSE, and that we'd thus want to do on "hidden" fields as well). So, "hidden" being an actual widget makes some sense.
So, while I do of regret having "hidden on forms" and "hidden on display" treated differently, it kind of makes sense code wise :-/.
I'm open to discussion though...
Comment #25
sunHm. I don't understand how a HiddenWidget could insert default values? — If you configure no widget (the HiddenWidget), then I don't think you are able to enter a default value in the first place, since, yeah, there's no widget...? :)
All you could reasonably do is to iterate over the defined schema #columns and turn those into corresponding #type 'value' sub-elements... with NULL values by default, and only for pre-existing entities/fields, the existing values would be taken over as-is...?
Comment #26
yched CreditAttribution: yched commentedThat's how "default values" currently work for fields with field_access == FALSE - or for a programmatic entity_save with no incoming $entity->field_foo entry.
On *creation*, the default value gets assigned; on *edit of existing*, the current value (possibly empty) stays untouched.
So this would need to be the behavior for "hidden" fields as well.
Although, contrary to what I wrote in #24, that behavior might actually be enforced in field_default_insert() anyway, so the form side of a "hidden" widget might not need to care about it.
So that's one argument less for treating "hidden on forms" as a widget rather than as a special 'hidden' case baked in Field API's form handling (i.e more akin to "hidden on display")
Comment #27
amateescu CreditAttribution: amateescu commentedHere is a straight port of the existing code from Field extra widgets (which, btw, is from @Damien, not @dww). Tested manually and it works for all existing use cases that were mentioned in this issue (required fields, changing the number of minimum allowed values for a required field, submitting an entity edit form with a field that already has some values in the db).
I guess what we need now is some test coverage and maybe to bring over the UI for the hidden region from Display settings. I couldn't do the them in this initial patch due to lack of time..
Comment #28
patrickd CreditAttribution: patrickd commentedpatch works good so far,
but I can't set a default value in the fields configuration as the default value field is hidden too
IMHO, that's not how it's supposed to be?
Comment #29
amateescu CreditAttribution: amateescu commentedWell, to set a default value you need to have a (editable) widget, so I don't see how that can work with this generic hidden one.
Comment #30
yched CreditAttribution: yched commentedApologies for the wrong attribution of Field extra widgets - I fixed my earlier comment :-).
Hm - the code is dead simple... what does "it works on required fields" mean ?
I'm not sure I get what that means either :-)
- Has the code been tested to work fine when creating a new revision ? (i.e the existing value of the hidden field must be carried over to the new revision)
- Has the code been tested wrt default values ? i.e when a default value is configured for the field and it uses the "hidden" widget, creating a new node should result in the default value being saved in the node
- Regarding #28 ("can't set a default value in the fields configuration as the default value field is hidden too"), I guess that would need a special hack in Field UI to switch to the field type's 'default widget' when the current selected widget is "hidden".
Not fully decided which approach I'd favor - a) "hidden" as a widget, or b) "hidden" as a 'region', handled by special-case non-widget code in field form code.
b) is more consistent with how we deal with this on the display side, which might prove easier when we start leveraging the EntityDisplay objects (introduced by #1852966: Rework entity display settings around EntityDisplay config entity) on the form side (and we'll need to if we want configurability for #1510532: [META] Implement the new create content page design)
But b) also means extra-fields can be dragged to this "hidden" region as well, and I'm not sure the existing ones are ready for that case - extra fields exposed on forms currently assume they'll be present in the final form.
I guess I'm fine with getting it in as a widget for now, as possibly reconsider later on.
We'd need tests though - for the cases mentioned above, notably.
Comment #31
amateescu CreditAttribution: amateescu commentedUsing the default widget in the instance settings form sounds good to me, here's an updated patch for that. Next up, tests :)
It means that there's no validation error on an entity form which has a required field instance that's using the hidden widget.
I was trying to say that I tested this case:
[Edit]
Not yet.
Yep, manually, and it works :)
[/Edit]
P.S. I don't like the name of the optional argument introduced for
getWidget()
at all.. but couldn't find anything else at this time of night :/Comment #33
yched CreditAttribution: yched commentedRight, and that is a problem :-) From my #17:
Required fields are the main conceptual issue when adding the ability for users to hide any arbitrary field on forms, and the main reason CCK and Field API didn't allow it so far :-/
re: getWidget($instance_settings_form = FALSE) :
Yeah, not ideal, but we have no other solution than a hacky one here. Will be cleaner when entity form configuration gets refactored based on EntityDisplays too. 'widget' properties won't be stored in $instance anymore, and you'll be able to generate a form input for an instance using any arbitrary (eligible) widget.
I'd suggest an $allow_hidden param defaulting to TRUE, though.
Comment #34
amateescu CreditAttribution: amateescu commentedThanks for explaining again the issue with required fields, I finally got it now :)
So, here's an updated patch that:
- make the required checkbox disabled and adds a helpful description if the instance is using the hidden widget
- doesn't display the hidden widget as an option in the Widget Type screen if the instance is required
- changes the awful
$instance_settings_form
parameter to$allow_hidden
- adds tests for the cases specified in #30
I wonder if we should cater for fields defined in code as well by throwing an exception (
FieldIncompatibleDefinitionException
perhaps) in field_update_instance() if the definition has required => TRUE and uses the hidden widget.Adding the usability tag for the new description text that is introduced in the instance settings form.
Comment #35
tstoecklerI might have missed some of the discussion, but why can required fields not be required? It probably doesn't make much of a difference, but I would think if the default value isn't empty everything should be fine, no? So I would have expected making a hidden field required simply makes the default value form required.
Comment #36
Bojhan CreditAttribution: Bojhan commentedAlright, I don't like having disabled forms - checkboxes, or anything. They are a bad usability practice, as people often do not understand why its disabled and return to just clicking it often enough to get it to work.
If you can't set this required, lets just not offer them the option. I am confident the 80% usecase, would be to not even look for this checkbox anyway. The other 20% with some logic can probably determine you can't set a hidden field required.
I still think the actual correct way to solve this would be to introduce "Form" as a view mode.
Comment #37
amateescu CreditAttribution: amateescu commentedAs I said in IRC, in the current Field UI which separates the widget selection from the instance settings form, I highly doubt people will 'quickly' realize why the required checkbox is gone.
Err.. wat? :) Why can't *hidden* fields not be required? The answer is in #33.
Comment #38
Damien Tournoud CreditAttribution: Damien Tournoud commentedI think we should allow required fields to be hidden. That just means that they will always fail validation of their entity if they are not filled by some other means (prepopulation, etc.). That's a complete corner case, and it is totally fine. No need to add more complexity where it is not required.
Comment #39
amateescu CreditAttribution: amateescu commentedLet's see if Yves has some feedback.
Comment #40
yched CreditAttribution: yched commented@Damien:
Well, AFAIK, the general UX philosophy in core is "don't let users enter inconsistent configuration", or at least two config items that blatantly contradict each other.
What's the problem with this ? :
- if widget is "hidden", then raise a validation error of submit of the "instance edit" form if "required & empty default value"
- if field instance is "required & empty default value", then "hidden" is not available in the widget dropdown on "change widget type" form ?
Comment #41
Damien Tournoud CreditAttribution: Damien Tournoud commentedThe default value can come from many other places. The most common use case for an hidden field is pre-populating via another mean (URL parameter, etc.). I'm happy with a warning, if we want to make things more complicated for such a small UX gain. But really, there are many other ways to shoot yourself in the foot with the Field UI, I don't see the need to focus on this particular corner case.
Comment #42
yched CreditAttribution: yched commented"The most common use case for an hidden field is pre-populating via another mean".
Then this other means involves some code somewhere, which is independent and unrelated to the fact that the field is configured to use a "hidden" widget or not.
In which case, I'd think it would be the role of this code to do its job and hide the widget through hook_field_attach_form_alter() when its conditions are met (like, the URL querystring contains a default value) - no need for a "hidden widget" for that ?
Comment #43
tstoeckler#40 is exactly what I tried to propose, but couldn't explain it as well as @yched did. I totally agree with the assessment.
Comment #44
sunAny chance to move forward here? It's not entirely clear to me what's left to be done for the latest patch in #34?
Comment #45
amateescu CreditAttribution: amateescu commentedSame for me...
Comment #46
yched CreditAttribution: yched commentedSo, summarizing:
The discussion stumbled on "do we want to prevent site admins from configuring a field to be all of: a) required, b) without a default value, and c) using the 'hidden' widget".
- in current HEAD, 'required' is currently only enforced through FAPI #required property, which wouldn't trigger with the hidden widget, so this setup would silently save "invalid" entities (a field marked as required is actually empty)
- If #1696648: [META] Untie content entity validation from form validation succeeds, OTOH, 'required' is going to be checked at the property level, and this setup would produce forms that can never validate.
So the question is : do we want to prevent that setup with an error on Field UI form validation ?
@Damien advocates that there are cases where this setup might actually be what you want, because the default value is populated by external code (e.g from a URL param).
- The old nodereference_url used to do that with a specific widget, so not our worry.
- But entityreference_prepopulate works on top of any widget, allowing advanced behavior like: hide the widget completely, disable it, or leave it editable, just filling a proposed value. So, right, while very non-80%, it makes sense for the "hidden widget" to work with that too.
So I'd probably advocate outputting a warning instead of an error : "Field foo is required and uses the "hidden" widget. You might want to configure a default value", but still submit the config.
Comment #47
amateescu CreditAttribution: amateescu commentedThanks Yves for a great summary! I agree with the proposed solution and I'll get back to the patch this week.
Comment #48
amateescu CreditAttribution: amateescu commentedHere we go. This patch solves everyone's concerns so I think we're ready here.
Comment #49
patrickd CreditAttribution: patrickd commenteddid some testing
- created a text-field with " - hidden -" widget, not required, no default value, saved.
- created a text-field with "text" widget, set to required, no default value, saved - changed widget to "- hidden -" afterwards. (got the warning about the default value)
- created a boolean-field with "- hidden -" widget... on the field edit page I got:
Notice: Undefined index: id in Drupal\field\FieldInstance->getWidget() (line 59 of core/modules/field/lib/Drupal/field/FieldInstance.php).
Set to required and chose N/A as default value, saved the field and got the same error 3 times again, no warning.
- created an image field with " - hidden -" widget, required, no default value, saved - got the warning about the default value
- created an integer field with "- hidden -" widget, required, with default value, saved - got a warning?!
- go to the content creation page, created content
fields with "- hidden -" widget - were hidden! yay!
saved the content, hidden fields without default value were empty, hidden fields with default value - had a default value.
TL;DR
so far everything seemed to work as expected.
the only thing I found a bit strange is that I got the warning to set a default value even when a default value was set, that's kind of confusing. Maybe we can check with _is_empty() whether a default value is given, and only show the warning when it is indeed - empty.
thanks for the patch !!! :)
It also has a unit test for the new feature.. so for me this seems RTBC
Comment #50
swentel CreditAttribution: swentel commentedWe can't really set to RTBC if there are notices right ... from #49
Comment #51
patrickd CreditAttribution: patrickd commentedoh, yes, I first thought that notice was independent from having the patch applied, but I just tested it without and I didn't get the notices. (so yes this need work, sorry)
Comment #52
amateescu CreditAttribution: amateescu commentedInteresting that notice is :) It comes from the fact that the field type's default widget isn't converted to a plugin yet. I included a small fix for it in this patch.
The second one, getting the warning when you had a default value specified was just a typo from me :/
Comment #53
patrickd CreditAttribution: patrickd commentedI retried the tests from #49
And now the notices are gone and there's no warning to set a default value, when the field is required and a default value is actually already set.
Now everything seems to work as expected.
Screenshots of UI changes:
Core gates say we need someone to have a look at UI changes. Tagged
Comment #54
amateescu CreditAttribution: amateescu commentedI think 'Needs usability review' is a better tag to bring in the UX team :P
Comment #55
Bojhan CreditAttribution: Bojhan commentedJust wondering, in views we use "Excluded from display", is it also "Hidden from display" here?
Comment #56
patrickd CreditAttribution: patrickd commentedHiding things from display has always been possible in d7, this is about whether to show a widget on the editing page of entities
Comment #57
tstoecklerComing a little late to the party (and in fact we could/should discuss this in a follow-up), but I think any module that adds that sort of "magic" default value should be capable of altering the UI, and removing such a warning, no?
Comment #58
yched CreditAttribution: yched commentedre @tstoeckler : that was my point in #42 too, but then looking at what entity_reference prepopulate does, I didn't really find a way for it to prevent the form error from being set - or unset it once it's been set.
Comment #59
yched CreditAttribution: yched commentedLet's explicitly mention "the widget used for 'default value' input".
Also, I'm really not fond of that code/logic in here. I might be wrong, but I think modifying the $instance['widget']['type'] in field_ui just before calling its getWidget() should work, and be cleaner - not using the "hidden" widget for 'default value' input is field_ui's problem.
Uh - missing indeed...
I even think we should drop the if (!isset())
Nitpick : plz add that we're testing the default value.
we should also check for empty($instance['default_value_function']).
(same for the other form)
Other than that, cool, and tests++ !
Comment #60
amateescu CreditAttribution: amateescu commentedYou're right about field_ui's responsability, and it works very well with just a new $skip_cache argument for
getWidget()
.Fixed the other issues raised above as well.
Comment #61
amateescu CreditAttribution: amateescu commented@yched asked me in IRC to find out why that
$skip_cache
argument was still needed, and it turns out that$instance['widget']['type'] = $default_widget['id'];
didn't callFieldInstance::offsetSet()
(more details here).Comment #62
yched CreditAttribution: yched commentedYay ! RTBC if green.
Thanks for the perseverance @amateescu :-)
Comment #63
patrickd CreditAttribution: patrickd commentedDid another round of manual testing, patch works great!
thank you all! :)
Comment #64
amateescu CreditAttribution: amateescu commentedMy conscience wouldn't let me slip that unrelated change from FieldInstance.php :/
Comment #65
xjm#64: hidden_widget-1465774-64.patch queued for re-testing.
Comment #66
tstoecklerRe #58: Again, I don't want to hold this patch up, but adressing this here anyway.
It would require some changes, but I don't think it would be particularly hard to make this properly alterable from contrib. I would suggest the following: Introduce a validation handler that sets
$form_state['#empty_default_value']
based upon the if check above. Then in a second validation handler we checkif ($form_state['#empty_default_value'] && $form_state['values']['instance']['widget']['type'] == 'field_hidden')
and then set a form error. Then contrib can simply add a validation handler in between that sets$form_state['#empty_default_value']
toFALSE
.Comment #67
amateescu CreditAttribution: amateescu commentedDiscussed a bit with @yched and @swentel and we agreed that using 'hidden' makes more sense for the plugin id, even though 'field_hidden' is consistent with "prefix by the name of the provider module" rule to avoid clashes, this is very much a special case plugin and it also matches the 'hidden' select key used in the 'Manage display' form.
Re #66:
Maybe we should open a followup to discuss if we want to keep the current warning or turn it into an error? Your approach would work, of course, but it seems a bit convoluted for core to do it and for contrib or custom code to go through all that trouble just to be allowed to save a form..
Comment #68
yched CreditAttribution: yched commentedAgreed with both points in #67, and confirming RTBC if still green.
Comment #69
webchickAs far as I can tell, this is a new feature and therefore should likely be bound by thresholds. We're not anywhere close to being able to commit new features atm, but hopefully we will be someday. :)
Comment #70
amateescu CreditAttribution: amateescu commentedNope, this is a task, see #20 :)
Comment #71
catchI'm not sure this is needed for user pictures any more, at least once [#http://drupal.org/node/1853378] is in - although that still has special-cased theme toggles in the current patch so if widgets could be applied to entity properties perhaps it'd allow for removing those?
Comment #72
alexpottCommitted 809138a and pushed to 8.x. Thanks!
Fixed documentation standards on commit...
Comment #73
jibranCreated http://drupal.org/node/1968224
Comment #74
swentel CreditAttribution: swentel commentedLooks good to me.
Comment #75
marcvangendI just came here after reading read the change notice, which doesn't really tell me how it works, what it does to the html output (an input with type=hidden or nothing at all?) and how I can set the value of a hidden field.
Can someone expand the change notice, or is there a better place to document the behavior?
Comment #76
marcvangend(Oops, didn't mean to add the tag again.)
Comment #77
webchickMarking "needs work" to get some more eyeballs on this. Thanks for reviewing the change notice, Marc!
Comment #78
alexpottConsidering there is still change notice work to be done / agreed upon... setting tags / title / priority appropriately
Comment #79
patrickd CreditAttribution: patrickd commentedComment #80
patrickd CreditAttribution: patrickd commentedAdded more explanations about the typical questions I got for this feature
(in my best possible english - feel free to edit)
http://drupal.org/node/1968224
Comment #81
jibran#75 is addressed in http://drupal.org/node/1968224/revisions/view/2644910/2647428. So back to fixed. Thanks @patrickd for the changes.
Comment #82
marcvangendThanks Patrick. That's much more useful.
Comment #84
jpstrikesback CreditAttribution: jpstrikesback commentedAttached is a the above backported to D7, sans tests. I found that autocomplete fields would not work unless I switched to that widget and then back to the hidden widget.
Comment #85
jpstrikesback CreditAttribution: jpstrikesback commentedUgh, wrong patch, this one is a bit better.
Comment #87
tim.plunkettYou might need to reupload.
Comment #88
jpstrikesback CreditAttribution: jpstrikesback commentedLet's try that again
Comment #89
jpstrikesback CreditAttribution: jpstrikesback commentedComment #91
jpstrikesback CreditAttribution: jpstrikesback commentedAnd again.
Comment #92
jpstrikesback CreditAttribution: jpstrikesback commentedAnd again.
Comment #93
yched CreditAttribution: yched commentedNote: #2060705: Remove the 'hidden widget' plugin, it is actually never used :-)
Comment #94
yched CreditAttribution: yched commented(doesn't exclude a D7 backport, though)
Comment #95
amateescu CreditAttribution: amateescu commentedThe exact same code is provided by the field_extrawidgets module..
Comment #96
jpstrikesback CreditAttribution: jpstrikesback commented@amateescu, the key area this is different is that it provides a back door into field_ui_default_value_widget() and so a default value may be set via the field edit UI.
Comment #96.0
jpstrikesback CreditAttribution: jpstrikesback commentedAdded short summary
Comment #98
ladybug_3777 CreditAttribution: ladybug_3777 commentedI got excited reading through these comments, but now that I've reached the end it looks like this never made it through?
So far the best solution I have to this readonly field issue for D7 is to combine the 2 modules "Field Permissions"(https://www.drupal.org/project/field_permissions) and "Field ReadOnly" (https://www.drupal.org/project/field_readonly)
Anyone else have a different solution they are using?
Comment #103
marcvangendShouldn't status be "fixed"? Or am I missing something?
Comment #104
patrickd CreditAttribution: patrickd commentedhmm, yup I think so too!
The only issue now that I'm aware of is that hiding the Title widget will get you an exception when trying to save a node, but i think there's already an issue about that.
Comment #105
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThe latest patches are just backporting the patch to D7, but we should open a separate issue for that.
Comment #107
IT-CruI can't find this in D8 core 8.5.x.
Does I miss something or is lost or removed since 8.5.x? For example I can't find
field_field_widget_info_alter
in drupal:field core module.Comment #108
amateescu CreditAttribution: amateescu for Pfizer, Inc. commented@IT-Cru, see #93 / #2060705: Remove the 'hidden widget' plugin, it is actually never used :)