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.
Comment | File | Size | Author |
---|---|---|---|
#51 | contact-message-ng-1983548-51.patch | 29.11 KB | effulgentsia |
#51 | interdiff.txt | 640 bytes | effulgentsia |
#44 | contact-message-ng-1983548-44.patch | 29.09 KB | Berdir |
#44 | contact-message-ng-1983548-44-interdiff.txt | 1.28 KB | Berdir |
#38 | contact-message-ng-1983548-38.patch | 29.09 KB | Berdir |
Comments
Comment #1
effulgentsia CreditAttribution: effulgentsia commentedRaising to major because blocking #1983554: Remove BC-mode from EntityNG .
Comment #2
BerdirHere's an initial patch, mostly trivial except we might need to deal with the user special case and make that a locked category or so so that we have a bundle. EntityNG doesn't like it if you define a bundle but don't specify it.
Comment #3
BerdirEh.
Comment #4
fagoYep, not knowing the (complete) type of an entity makes things complicated. However entity_create() already documents that the bundle is required anyway. If we add support for optional bundles, I think this state should be valid through the overall life-cycle of an entity, i.e. also allow a loaded $entity to be of type 'contact_message' or 'contact_message.category'.
Comment #5
BerdirIn this case, it's not about not knowing the bundle. It means it doesn't have one. Which could be a specific locked bundle.
Comment #6
BerdirHere's an initial attempt at making personal a special contact category. See also #1831928: Support a 'locked' property on ConfigEntities.
This actually allows you to attach fields to personal contact forms as well. But when I wanted to test it I noticed that the field UI seems to be broken currently, so we're missing tests there I guess? Not a problem of this issue AFAICT.
Comment #8
andypostPatch looks good. Suppose "personal" better to leave in it's own issue #1856556: Convert user contact form into a contact category/bundle
Comment #9
BerdirIt's a blocker for this issue (EntityNG always requires a bundle for entities with multiple bundles), so we either have to postpone this issue on that or integrate it.
Comment #10
BerdirRe-rolled on top of #1856556: Convert user contact form into a contact category/bundle.
Comment #12
BerdirRe-roll after the personal bundle issue went in. Let's see if test are in a better shape now.
Comment #13
Berdir#12: contact-message-ng-1983548-12.patch queued for re-testing.
Comment #15
fagoPatch is really straight-forward. Here a few remarks:
label and description does not really match. Usually we call it ID always, maybe we want to revisit that as part of http://drupal.org/node/1233394 - the way we do it usually for fields is that we don't have ID in the name.
Also the category is required right? So it should denote:
required => TRUE
Should use single quotes.
Should use single quotes.
Should use single quotes.
Comment #16
BerdirHm. This started of as a simple re-roll and then I started testing and noticed oooooh so many broken things. And most of them are now fixed, with various things covered by tests now.
Here's a list of changes and bugfixes
- Fixed the things pointed out by @fago above
- Also removed the translatable TRUE for recipient that I forgot in there
- Made email an email_field, that I had to copy to Drupal\Core\Entity
- Made copy a boolean_field
- Added methods to the MessageInterface, using them and removed the public properties init() hack, similar to the files conversion.
(Now we're getting to the fun part)
- Manage fields/display were missing completely, added the necessary entity type annotation stuff, Had to trick a bit with the edit form, as that somehow broke as a result of that.
- Noticed a @todo in contact_field_extra_fields() that we forgot to update when making personal a bundle, we can do that very nicely now (only showing the recipient name as extra field for the personal bundle)
- personal messages did *not* usage the user_mail/copy message keys, they used the page_* ones, including an empty !category in subject. The tests didn't see this because we didn't assert the mail key nor the full subject, just the string put in by the user. Added/updated test assertions
- The user keys did not yet use the render controller.
- $params['recipient'] was missing in the mail params, this was used by user_mail, but as we had the wrong key, so we never got to that part of the code.
A lot of those fixes aren't really related to this conversion but you can't properly test it without most of those being fixed. Like actually adding a field and verifying that it's added to the mail. For which we have zero test coverage, as far as I can see.
Comment #17
BerdirStarting to use that tag for things we need to do to complete conversion, remove BC layer and fully convert field API to Entity Field API/Typed data.
Comment #18
andypostNice clean-up
Comment #19
fagoGood improvements. However, once we add methods it should be complete, thus include setter methods. Else, patch looks good to me as well.
That sounds like it makes a copy - so I don't think it's a good name. Maybe just getCopy() or getCopyFlag() ?
Comment #20
BerdirYes, I wasn't sure about copy(), but getCopy() sounds like it returns a copy.
Not sure about settters, there are no cases where they are used in core, we just build the entity from the form data and send it. Not sure what kind of use cases could use methods?
Comment #21
msonnabaum CreditAttribution: msonnabaum commentedAgreed with Berdir. Not having setters communicates how this entity is used.
Comment #22
BerdirRenamed to copySender().
I did come up with one use case, and that would be altering the message in a prepare_view or something like that. But I think that's not blocking this and is a api addition, so we can add that any time later on.
Comment #23
fagoNot having those setter methods would indicate that we cannot change its entity fields - but that's not the case. While we support changing the fields, the entity is read-only storage wise though - so I opened the related issue #2019031: Allow entity types to be flagged as read-only. Please comment there.
However note, it's even already written to the fields, the fields are changed e.g. through the form or during creation. Yes, this works with the general setter, but *we do support setting* - so let's do not pretend we don't and add that methods.
Comment #24
LukyLuke_ch CreditAttribution: LukyLuke_ch commentedAdded the setter funcitons.
I'm not sure if/where they should be used now...
Comment #26
LukyLuke_ch CreditAttribution: LukyLuke_ch commented#24: contact-message-ng-1983548-24.patch queued for re-testing.
Comment #28
Berdir#24: contact-message-ng-1983548-24.patch queued for re-testing.
Comment #29
LukyLuke_ch CreditAttribution: LukyLuke_ch commentedAdded tests for message entity.
Comment #30
Berdirshould be sent or should receive I think, instead become, that sounds... german :)
Missing leading \, Contains \Drupal\...
Should only be a single empty line.
Should have an empty line after the last function and before closing } of the class.
Missing newline at the end.
Comment #31
giammi CreditAttribution: giammi commentedImplemented changes as requested
Comment #32
giammi CreditAttribution: giammi commentedComment #33
fagoDocumentation summary should start with a 3rd person verb, i.e. "Sets the name.." instead of "Set the". This applies to all setters.
Type-hint should start lower-case.
Missing space after (bool)
Comment #34
BerdirUps, should have catched that. Also changed camel case method arguments, we don't do that.
This will conflict quite a bit with #2010290: Editing a config entity from a listing page results in a 'page not found' and I'm fixing multiple from there already too for contact categories, wouldn't be sad to see this get in first :)
Comment #35
fagoPatch looks good now, however the other one got committed.
Comment #36
fago#34: contact-message-ng-1983548-34.patch queued for re-testing.
Comment #38
BerdirRe-roll and merged in the test coverage for fields and also extended it a bit from the other issue. Re-add the manage field links that were incorrectly removed over there.
Comment #40
Berdir#38: contact-message-ng-1983548-38.patch queued for re-testing.
Failed to write configuration... We need to figure this one out, seeing a lot of them.
Comment #41
fagoGreat, this is ready then.
Comment #42
larowlanNice! /me puts that one in memory bank
Comment #43
alexpottSome very minor nits... would not have posted the first if I hadn't spotted the second...
$uri can be assigned inside the if ()...
This can be removed
Comment #44
BerdirFixed that.
Comment #46
Berdir#44: contact-message-ng-1983548-44.patch queued for re-testing.
Comment #48
effulgentsia CreditAttribution: effulgentsia commented#44: contact-message-ng-1983548-44.patch queued for re-testing.
Comment #49
effulgentsia CreditAttribution: effulgentsia commentedbot's happy, so back to rtbc.
Comment #50
alexpottThe CategoryListController has the moduleHandler injected as $this->moduleHandler so we can use this...
Comment #51
effulgentsia CreditAttribution: effulgentsia commentedTrivial change, so back to RTBC.
Comment #53
effulgentsia CreditAttribution: effulgentsia commented#51: contact-message-ng-1983548-51.patch queued for re-testing.
Comment #55
effulgentsia CreditAttribution: effulgentsia commented#51: contact-message-ng-1983548-51.patch queued for re-testing.
Comment #57
effulgentsia CreditAttribution: effulgentsia commented#51: contact-message-ng-1983548-51.patch queued for re-testing.
Comment #58
effulgentsia CreditAttribution: effulgentsia commentedPre-emptively RTBC'ing, because I'm feeling lucky that we're on a good bot this time :)
Comment #59
alexpottCommitted 4756994 and pushed to 8.x. Thanks!
I think we might need to update the original contact to config entity change notice.
Comment #60
Berdir#1588422: Convert contact categories to configuration system never got a change notice. I'll create one for that and this issue combined... tomorrow.
Comment #61
BerdirCreated https://drupal.org/node/2023711
Not sure about code examples, can't really think of anything useful...
Comment #62
andypostThe notice just enough
Comment #63
BerdirRemoving sprint and change notice tag.