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.

Comments

vegantriathlete created an issue. See original summary.

mile23’s picture

Status: Needs review » Needs work

Thanks. Good catch: If we're going to use ContentEntityBase then 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.

vegantriathlete’s picture

I'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.

mile23’s picture

The 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.

vegantriathlete’s picture

Yes, 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.

vegantriathlete’s picture

I 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.

mile23’s picture

Issue tags: +Needs reroll

Patch no longer applies.

ajits’s picture

Assigned: Unassigned » ajits
Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new2.93 KB

Rerolled against the latest 8.x-1.x branch.

ajits’s picture

Assigned: ajits » Unassigned
Issue tags: +DCPune19

Unassigned. Added DCPune19 as this was done as a part of the workshop.

avpaderno’s picture

Version: 8.x-1.x-dev » 4.0.x-dev
Component: Content Entity Example » Code
Status: Needs review » Needs work
Issue tags: +Needs merge request