Part of #1876712: [meta] Convert all tables in core to new #type 'table'

Convert the Languages admin screen 'admin/config/regional/language' to use new #type 'table' and its tabledrag support, and remove specific theme function theme_language_admin_overview_form_table()

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kim.pepper’s picture

Issue tags: +Novice, +API clean-up, +#pnx-sprint

Tagging

plopesc’s picture

Attaching patch that rewrites the table creation process according to new #type 'table' element.

plopesc’s picture

Status: Active » Needs review

Updating status

Status: Needs review » Needs work

The last submitted patch, language_table-1877338-2.patch, failed testing.

plopesc’s picture

Sorry, I removed three necessary lines for the locale module integration.

Re-rolling patch.

plopesc’s picture

Status: Needs work » Needs review

Changing status

Status: Needs review » Needs work

The last submitted patch, language_table-1877338-4.patch, failed testing.

plopesc’s picture

Status: Needs work » Needs review
FileSize
2.65 KB

Patch fixed.

sun’s picture

Thanks! I think this is correct and almost complete.

Thanks for splitting a first conversion out from #1876712: [meta] Convert all tables in core to new #type 'table' to review and discuss it in more detail.

However, I think we want to perform almost all of the remaining conversions in one fell swoop in #1876712: [meta] Convert all tables in core to new #type 'table', since the resulting patch will only be large, but not really complex. AFAIK, there are only a few instances of more complex tables left in core, which I think involve #tableselect (not #tabledrag). In any case, I think we can do all of the simple conversions in one go after this one.

The only two issues I can see with this patch:

+++ b/core/modules/language/language.admin.inc
@@ -20,16 +20,20 @@ function language_admin_overview_form($form, &$form_state) {
     '#languages' => $languages,
     '#language_default' => $default,
     '#tree' => TRUE,

1) #tree can definitely be removed. #type 'table' sets that by default already.

2) #languages and #language_default seem to be obsolete, too?

plopesc’s picture

Hello

Thanks for your review. I removed hte #tree attribute, following your advice. However, #languages and #language_default attributes can't be removed, because are required by locale module to add the operations column to the table.

Removing these two attributes, tests are not passed, as you can see in #1.

Regards.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Oh, I see.

We might want to create a separate issue for those language properties then. For one, it's a bit strange that they are added to the top-level table element, instead of the corresponding table row. And second, we actually try to avoid adding raw data objects in the $form structure; contextual data objects are added and tracked in $form_state normally; i.e., $form['languages']['#languages'] becomes $form_state['languages'] and $form['languages']['#language_default'] becomes $form_state['language_default'].

Not to be changed in here, but I think that would make a nice clean-up issue — anyone willing to take that on? :)

This patch is ready to go, thanks! :)

kim.pepper’s picture

plopesc’s picture

Sorry, I created this follow up issue #1882448: Decouple language and locale modules in language_admin_overview_form() , but I forgot to add the comment here.

Includes patch that passes the tests.

Regards

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Thanks.

Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-base

Retroactively tagging for D8MI :)

Automatically closed -- issue fixed for 2 weeks with no activity.