Problem/Motivation
Follow-up from #2225399: Apply formatters and widgets to Feed base fields.
There are only small differences between the StringTextfieldWidget, StringTextareaWidget and UriWidget classes and they repeat some code that could be moved into a base class. This would make the classes cleaner and make it easier to create further string widgets.
Also UriWidget
should be set as default_widget
for \Drupal\Core\Field\Plugin\Field\FieldType\UriItem
Proposed Resolution
StringTextfieldWidget, StringTextareaWidget and UriWidget should inherit from a common base class.
Remaining Tasks
A StringWidgetBase class can be used for some of the shared functionality, but StringTextfieldWidget and UriWidget share more functionality than StringTextareaWidget. This means that a single base class can't be used to remove all the shared code without the child classes deleting things inherited from their parent. None of these classes are particularly large so it needs to be decided whether more small files are preferable to repeated code.
Comment | File | Size | Author |
---|---|---|---|
#14 | inherit_uriwidget_from-2236599-14.patch | 9.85 KB | stephen-cox |
#9 | interdiff-2236599-2-9.txt | 6.15 KB | l0ke |
#9 | uri-extend-string-2236599-9.patch | 8 KB | l0ke |
#2 | 2236599-uri-extend-string.patch | 2.7 KB | mr.baileys |
Comments
Comment #1
andypostComment #2
mr.baileysLike this?
Comment #3
andypostyes, awesome
Comment #4
andypostSuppose better to address #2225399-65: Apply formatters and widgets to Feed base fields in own issue
Comment #5
alexpottThis makes me think this might not be a good idea
Comment #6
tstoecklerSo StringWidget has
which is what we're removing here.
I don't know why we have that, but if we want to keep it, maybe we can do a StringWidgetBase, so that StringWidget only extends that one to add that class.
Comment #7
andypostnw for #6, seems a way to solve
Comment #8
l0keComment #9
l0keAdded StringWidgetBase.
Comment #10
awilliams CreditAttribution: awilliams commentedI am trying to re-apply the patch if its still applies from Amsterdam
Comment #13
awilliams CreditAttribution: awilliams commentedComment #14
stephen-cox CreditAttribution: stephen-cox commentedThis task has become more complicated since the addition of a StringTextareaWidget class (in #1856562: Convert "Subject" and "Message" into Message base fields) to accompany the UriWidget and the StringTextfieldWidget (renamed from StringWidget) classes.
The included patch is a re-role of #9 to deal with this extra complication. There is still some repeated code in UriWidget and StringTextfieldWidget, but I'm unsure if this is enough to warrant another base class.
Comment #15
stephen-cox CreditAttribution: stephen-cox commentedUpdated summary to reflect recent changes in the widget classes.
Comment #17
andypostThe issue needs new summary and purpose.
The idea was that all string fields have the same settings (placeholder, size) , specifically UriWidget and StringTextfieldWidget (decoupled in #2313757: Remove text_processing option from text fields, expose existing string field types as plain text in UI) are mostly the same
Also needs to take into account #2407505: [meta] Finalize the menu links (and other user-entered paths) system
Comment #20
piyuesh23 CreditAttribution: piyuesh23 at QED42 commentedRemoving Novice tag, since the issue doesn't match the pointers mentioned on https://www.drupal.org/core-mentoring/novice-tasks. Also, as per the last comment, it needs new summary & purpose.
Comment #21
xjmThanks @piyuesh23!
This issue was marked as a beta target for the 8.0.x beta, but is not applicable as an 8.1.x beta target, so untagging for that as well.
This could potentially be implemented in a minor with BC (depending on what the new proposal actually is), so moving to 8.2.x.
Comment #33
quietone CreditAttribution: quietone at PreviousNext commentedThe
aggregator
module has been removed from Core in10.0.x-dev
and now lives on as a contrib module. Issues in the Core queue about theaggregator
module, like this one, have been moved to the contrib module queue.Comment #34
bradjones1This doesn't appear to be aggregator module but a core field type widget.
Comment #35
larowlanThanks, agree