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.
Updated: Comment #0
See Issue summary for #2010930: [META] Apply formatters and widgets to rendered entity base fields (all besides node.title)
- This issue is about the feed.title
and feed.url
base fields.
- A 'uri' widget (\Drupal\Core\Field\Plugin\Field\FieldWidget\UriWidget) has been added.
Comment | File | Size | Author |
---|---|---|---|
#66 | 2225399-66-feed-base-field-uri.patch | 1.29 KB | mr.baileys |
#58 | 2225399-58-feed-base-field-formatters-widgets.patch | 18.55 KB | visabhishek |
#58 | interdiff-2225399-53-58.txt | 2.53 KB | visabhishek |
#27 | 2225399-27-feed-base-field-formatters-widgets-do-not-test.patch | 16.48 KB | yanniboi |
#23 | interdiff-17-23.txt | 3.19 KB | marcvangend |
Comments
Comment #1
Wim LeersNote: this patch was split off from Berdir's patch in #2010930: [META] Apply formatters and widgets to rendered entity base fields (all besides node.title).
Comment #2
Wim LeersComment #5
mr.baileysAssigning to me to resolve the test failures during the Szeged sprint.
Comment #6
mr.baileysFixed the test failures.
Comment #8
mr.baileysFixed the remaining test failures.
Comment #9
yched CreditAttribution: yched commentedNote that 'title' was not exposed as an 'extra field' in HEAD, and so was not configurable (i.e eligible for drag-n-drop reorder) in Field UI "Manage forms" so far.
Probably no biggie, just pointing that this is a functionnal change.
Comment #10
BerdirGood point, but we simply didn't bother with extra fields when making feeds fieldable, so this seems fine with me. It wasn't explicitly not added.
Comment #11
marcvangendHere's my attempt at converting the URL form element to a base field. It also adds a 'uri' widget. I'm adding it as 'do-not-test' because relevant tests have not been adjusted yet, but I still wanted to share the progress.
Comment #12
BerdirMaybe we could somehow use #2054011: Implement built-in support for internal URLs for that? Would be quite a bit an overhead just to store the URL though, so maybe not.
Comment #13
yanniboi CreditAttribution: yanniboi commentedRe-triggering tests on last patch...
Comment #14
yanniboi CreditAttribution: yanniboi commentedOops, didnt see the 'do-not-test'. My mistake!
Comment #15
marcvangendRe #12: Maybe I didn't understand your question correctly, but usually feed URL's would be external, not internal, right?
Comment #16
yanniboi CreditAttribution: yanniboi commentedAfter having had a look at the UI, there doesn't seem to be an admin page for configuring feed fields (I may be wrong, I have never actually used the aggregate module).
Therefore I have made the title and url non-configurable.
Also the patch in #11 doesn't 'create' the file, UriWidget, but modifies a non-existent file... (not sure how that happened) so I fixed that in the patch.
Comment #17
marcvangendThanks for reviewing, yanniboi.
Here's a new patch and interdiff, including tests for the url field.
ToDo: convert the interval field.
Comment #18
yanniboi CreditAttribution: yanniboi commentedI am attempting to convert the interval field.
Comment #19
yanniboi CreditAttribution: yanniboi commentedI'm not sure if @marcvangend is actually already working on the interval field so unassigning myself...
Comment #20
marcvangendComment #21
marcvangendNew patch. This one includes the field for the refresh interval. I also made sure that the order of fields and all labels and descriptions exactly match the current situation.
Comment #23
marcvangendMy bad. Try again.
Comment #24
marcvangendComment #26
yanniboi CreditAttribution: yanniboi commentedOne small nitpick:
You add the allowed values here.
but forget to delete them here...
I'll quickly patch that because its not really a big deal.
Comment #27
yanniboi CreditAttribution: yanniboi commentedNot testing because I haven't fixed the test failures.
Comment #28
yanniboi CreditAttribution: yanniboi commentedI spent quite a while looking at DependencyTest, and I have no idea why our patch would change the order of the expected_modules variable, but the test is out of date anyway (and needs a follow up issue to look at it). This should pass tests.... (Fingers crossed)
Comment #30
BerdirYeah, DependencyTest is the pain.
This looks great, once we have the language widget we can completely remove the form method. Not sure what's messing with the user permission test, maybe the form isn't being submitted?
Comment #31
marcvangendGood catch in #26.
The DependencyTest must have changed because aggregator module now lists options module as a dependency, because it has a select widget on the form.
I'll try to fix the permission test.
Comment #32
yanniboi CreditAttribution: yanniboi commentedOk, @marcvangend and I had a look at the UserPermissionsTest and @Berdir suggested we replace the module enable form submit with a ModuleHandler()->install() function because that handles dependencies by default. We think this is OK because the test isn't concerned with module dependencies, but the permissions resulting from them.
Patch attached!
Comment #33
marcvangendComment #34
jibranmore then 80 chars and 2nd line after @todo starts after t of @todo :). See 1354#todo.
Comment #35
Wim LeersGreat work! :) I only have nitpicks.
s/Uri field/URI/
s/textfield/URI field/
s/URL/URI/
I know that the e-mail widget also has this whitespace, but it feels unnecessary. Let's delete it?
I still feel a bit ambiguous about this change. It's confusing (to me at least) that it doesn't match the Feed entity's schema (
hook_schema()
.However, if Berdir thinks this is good, then I'm fine with it :)
Please note that once entity schemas will be autogenerated based on
baseFieldDefinitions()
, this will cause a DB index to be created that currently doesn't exist.Comment #36
marcvangendComment #37
Wim LeersSorry, point 1 was nonsensical: just capitalize the "Uri", so please change "Uri field" to "URI field".
Comment #38
marcvangendNew patch. This fixes the points from #34 and #35. I didn't run all the tests again because I have a plane to catch, but I guess it will be fine :-)
Comment #39
marcvangendSorry, forget #38, I missed a file.
Comment #40
Wim LeersAwesome! Thanks a lot :)
This is good to go.
Comment #42
BerdirOnly list_integer has support for allowed values, so I guess we need to make that switch.
We're working on unifying the field types in #2150511: [meta] Deduplicate the set of available field types, but I'm not sure if this is subject to that. Would be nice to only have integer field type and make options.module just provide widgets, but not sure if that's feasible.
Comment #43
yched CreditAttribution: yched commentedlist_integer is not duplicating any other field type, so it is not in the current scope of #2150511: [meta] Deduplicate the set of available field types.
IIRC, one of the last blockers for moving list field types into Core/Field (aside from list_boolean, which is a bit aside and has its own issue already) is #2171397: Move options_allowed_values() to a method somewhere ?. @andypost is probably more up-to-speed on that topic that I have been lately :-/
Comment #44
BerdirTrue, it's not an exact duplicate, that's why I said it's not really in the scope of that :)
*But*, I find the name misleading (it's not about having a list of integers, but an integer field with a list of allowed values and select/options/checkboxes widgets) and it woud be nice if we could have just a single integer field type. Anyway, not a huge problem.
Comment #45
yched CreditAttribution: yched commentedname: true :-/
single integer field type: the problem is that a 'select' or 'checkbox' widget can only be applied to a field type that has a finite set of allowed values. If we have a single int field type that can be either opened- or closed-values, then it becomes fuzzy to decide when the select widget is applicable. Widgets are only eligible by field type.
Comment #46
Wim Leers#42–45: that's why I thought that having an
IntervalSelectWidget
forIntegerItem
might be more appropriate ("there are many interval options, but only one interval can be chosen, and an interval is an integer"). But IIRC marcvangend talked to fago, and fago guided him to this solution.Comment #47
marcvangendRe #46, I mainly guided myself to that solution, wondering if it was really needed to add a new widget while we already have a select widget (you know, DRY). Fago helped me when I got stuck on some typeddata error, he did not express an opinion about this specific solution.
Comment #48
Wim LeersOh, ok. I must've misunderstood then. Apologies. And thanks for clarifying! :)
Comment #49
BerdirYeah, I think this is the preferred way as well. Then we have this information available through the field definition and can validate it when entities are created in a different way instead of relying on a special widget.
Comment #50
Wim LeersAlrighty :)
Comment #52
mr.baileysStraight re-roll.
Comment #53
marcvangendThe patch in #52 removes one of the lines (introduced in #2177799: Allow IntegerItem's to be unsigned) that made the re-roll necessary in the first place. I'm adding it back in.
@mr.baileys, please try to create interdiffs, so small mistakes like this are easier to spot.
Comment #54
mr.baileys@marcvanged: apologies... Didn't know you could create an interdiff for rerolls btw...
Comment #55
Wim LeersBack to RTBC.
Comment #56
marcvangend@mr.baileys: no apologies needed, thanks for your help.
Comment #57
alexpott$this->t()
Let's fix the spelling mistake considering you are touching the line.
Comment #58
visabhishek CreditAttribution: visabhishek commentedi have updated the patch based on #57.
Comment #59
Wim LeersBack to RTBC.
Comment #60
catchCommitted/pushed to 8x, thanks!
Comment #61
Wim LeersWell done, marcvangend :)
Comment #62
tim.plunkettNo auto-commit message, must not have pushed
Comment #63
alexpottCommitted af9cd0f and pushed to 8.x. Thanks!
Comment #65
andypostFiled follow-up #2236599: Inherit UriWidget from StringTextfieldWidget
is wrong, 'uri' field type sets to 2048 but the schema defines 'text' so there's no way to build schema from this definition
Comment #66
mr.baileysChanged the data type for uri to varchar.
Comment #67
andypost#66 does not help here, base table defines 'text' (unlimited) about varchar has limits
Comment #68
yched CreditAttribution: yched commentedComment #71
BerdirWe are now generating the schema, so I assume whatever fix was necessary for this was done already. Closing again.