Note: This also corrects the bug that the language selector was not showing the value of the entity when editing an existing entity.
I did need to go into admin/config/regional/content-language to indicate to show the language selector on create and edit pages.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 2898379-8.patch | 2.93 KB | ajits |
| 0001-Leverage-ContentEntityBase-fields.patch | 3.49 KB | vegantriathlete |
Comments
Comment #2
mile23Thanks. Good catch: If we're going to use
ContentEntityBasethen we should actually use it. :-)So now we need a test that enables the language module and verifies that the language selector actually shows up on the form.
We also need to expand the docblock for ContactForm to explain that we're letting ContentEntityForm do the work for us, and that we'd otherwise implement buildForm() to customize the form.
Comment #3
vegantriathleteI'm not sure whether we need the language module. I'll have to look at another entity I've created for a production project. I don't believe I needed to go into the content language translation to indicate that the language dropdown should appear. In any case, I agree that this still needs more work.
Comment #4
mile23The language selector only displays if you have the language module enabled.
If that's not the point of this change, that's fine, too. We'd still need to update the form to say that we don't use a default entity form because we want a specific redirect.
Comment #5
vegantriathleteYes, we still want the redirect.
And we do want to leverage the langcode from the ContentEntityBase. It does make sense to me that we'd want to see the language dropdown only when language is enabled. The question is whether it could / should be able to show when content translation is not enabled. Once we enable content translation we then have access to the content language translation configuration to enable specific entities for translation. Once those entities are enabled we can check or uncheck the box that determines whether to show the language dropdown on add and edit forms. The thing that I wanted to double check was whether I had gotten the language dropdown to show independent of whether content translation is enabled.
Comment #6
vegantriathleteI had not gotten the dropdown to appear without content translation enabled and the entity set to show the dropdown on the add and edit forms.
So, the pieces that are outstanding are to create the test and expand the DocBlock as you said in comment #2.
Comment #7
mile23Patch no longer applies.
Comment #8
ajitsRerolled against the latest 8.x-1.x branch.
Comment #9
ajitsUnassigned. Added DCPune19 as this was done as a part of the workshop.
Comment #10
avpaderno