Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
During the usability study, we noticed that the widget settings exposes SQL syntax to the user with the uppercased "CONTAINS" on the Manage form display page:
This was also seen in an error message after the user tried to add a content page that had required a taxonomy term field.
Proposed resolution
The initial suggestion is to simply lowercase the word "CONTAINS". There might be other instances in which this occurs, as well as other SQL syntax verbiage that really doesn't need to be in uppercase in the UI.
Remaining tasks
None.
User interface changes
Lowercase text.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#17 | Screen Shot 2015-07-03 at 8.42.30 PM.png | 56.64 KB | davidhernandez |
#17 | lowercase_the_word-2513612-17.patch | 2.1 KB | davidhernandez |
Manage_form_display___drupal8.png | 11.31 KB | ivanstegic |
Comments
Comment #1
webchickEasy fix, easy issue! :) (As long as you can figure out where this text is coming from, which I haven't successfully yet.)
Comment #2
cilefen CreditAttribution: cilefen commentedI know - I tried.
Comment #3
davidhernandezcore/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php
CONTAINS
andSTARTS_WITH
should both be fixed, I assume.Comment #4
dorficus CreditAttribution: dorficus commentedComment #5
ivanstegic CreditAttribution: ivanstegic at TEN7 commentedI don't think this is an easy fix, actually. The "CONTAINS" and "STARTS_WITH" SQL keywords are actually the Keys in a dropdown somewhere, and to me, at least at this high level, it looks like those KEYS are being used in the widget, and not the VALUES. The only reason I say this is because it looks like there are already translate-able values in the referenced file:
Removing the novice tag because I couldn't find where this is in the code, neither could @webchick and because this really should be a translate-able, right?
Comment #6
dorficus CreditAttribution: dorficus commentedI'll go ahead and take myself off of it then. Thanks, ivanstegic.
Comment #7
dorficus CreditAttribution: dorficus commentedComment #8
davidhernandezThe text in question is printed below in
settingsSummary()
.Comment #9
davidhernandezThe settings form is what you actually see when you click the gear to change the settings.
Comment #10
webchickRight, so it seems like maybe we need a helper method that returns an array of settings in 'KEY' => t('Friendly') format, and then just call it from both places?
Comment #11
davidhernandezSure.
getMatchOperatorOptions()
or something? Use the array directly in settingsForm() and search it in settingsSummary().Comment #12
ivanstegic CreditAttribution: ivanstegic at TEN7 commentedIs this solution also going to fix the error message? IIRC this was in the error message as well.
Comment #13
davidhernandezI'm not sure which error message that would be. Can you provide steps to produce it?
Comment #14
ivanstegic CreditAttribution: ivanstegic at TEN7 commented@webchick do you remember how this was reproduced? I was trying to remember and checked the spreadsheet but could not for the life of me figure it out. Maybe the video will contain it?
Comment #15
webchickNo, sorry... I didn't actually see it happen. :( I think it was either you or Link who noted it.
Looks like it happened in session 1 around 9:22am. See Lewis's column at https://docs.google.com/spreadsheets/d/1iCcj2E4F4Nsns_HkDUnutCgEKWQc7kEu...
Comment #16
davidhernandezCan someone translate that doc? It looks like the person was editing the term reference field, (that is where you would see the setting to make Tags the default vocabulary) but there are no settings related to the autocomplete there.
Comment #17
davidhernandezThis should at least function.
Comment #18
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThat's the correct fix, thanks @davidhernandez!
Comment #19
cilefen CreditAttribution: cilefen commentedIs there any need for an automated test on this? I think not, but it is worth discussing.
Comment #20
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedI also don't think that this specific issue is worth testing.
Comment #21
davidhernandezI don't think it needs a test.
Comment #23
webchickGreat!
Committed and pushed to 8.0.x. Another one bites the dust! :)