Noticed in #2004428-1: Less ugly operations altering

Problem/Motivation

admin/structure/taxonomy

Error message
    Notice: Undefined offset: 3 in _menu_translate() (line 757 of core/includes/menu.inc).
    Symfony\Component\Routing\Exception\ResourceNotFoundException: in Drupal\Core\Routing\RouteProvider->getRouteCollectionForRequest() (line 122 of /Users/ctheys/foo/drupal/core/lib/Drupal/Core/Routing/RouteProvider.php).

this module passes testbot because we dont have test for taxonomy listing page to see if the translate link is in the operations drop button

Proposed resolution

TBD

Remaining tasks

  • Write test for taxonomy listing.
  • Propose and discuss a fix, link to related example if possible

.

Steps to reproduce

  1. Get config translation module
  2. install d8
  3. go to taxonomy listing admin/structure/taxonomy
  4. it works
  5. enable config translation
  6. reload page
  7. it has error

User interface changes

No.

API changes

Not expected.

Files: 
CommentFileSizeAuthor
#5 config_translation.taxonomy_admin_page_error.2004690-5.patch1.84 KBKristen Pol
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch config_translation.taxonomy_admin_page_error.2004690-5.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#2 i18n-config-trans-taxonomy-devel.png141.58 KBKristen Pol

Comments

Using devel I see that the route_name is:

config_translation.item.admin.structure.taxonomy._taxonomy_vocabulary_

Whereas if I go to views, these are like:

views_ui.list

Maybe that helps someone?

StatusFileSize
new141.58 KB

I guess somehow it's thinking it's on the translate version of the page when it's not. See the devel screenshot:

i18n-config-trans-taxonomy-devel.png

Ignore the "ooga" in the route_name... that was just me trying to see where it was set ;)

I'm thinking that maybe:

  // Alter the taxonomy form to add translation links.
  if ($form_id == 'taxonomy_overview_vocabularies') {
    foreach ($form as $id => &$vocabulary) {
      if (is_array($vocabulary) && isset($vocabulary['operations'])) {
        $vocabulary['operations']['#links']['translate'] = array(
          'title' => t('Translate'),
          'href' => 'admin/structure/taxonomy/' . $id . '/translate',
        );
      }
    }
  }

needs to be:

  // Alter the taxonomy form to add translation links.
  if ($form_id == 'taxonomy_overview_vocabularies') {
    foreach ($form['vocabularies'] as $id => &$vocabulary) {
      if (is_array($vocabulary) && isset($vocabulary['operations'])) {
        $vocabulary['operations']['#links']['translate'] = array(
          'title' => t('Translate'),
          'href' => 'admin/structure/taxonomy/' . $id . '/translate',
        );
      }
    }
  }

but it doesn't solve the error.

I figured it out... patch coming soon.

Status:Active» Needs review
StatusFileSize
new1.84 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch config_translation.taxonomy_admin_page_error.2004690-5.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Here's a patch. Now the page comes up and there's a translate link in the list but if you go to that translate page, there is nothing there (should be follow up issue). I don't see any code for the taxonomy translate page unless it's supposed to auto-magically happen in a generic way.

Status:Needs review» Fixed
Issue tags:+D8MI, +language-config

Looks like the path issue is due to https://drupal.org/node/1986784 change in core. The form likely also changed under us at some point. Good catches! Committed this patch. #2004710: Add tests for block, menu, vocabulary and views listings has tasks to add tests for this and other forms.

Good news that the patch at https://drupal.org/node/2004780#comment-7474128 fixes the errors I saw when going to the translate page for the vocabulary. Woohoo!

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