An error occurs on attempting to add meta tags via the custom Views admin pages.

Way to reproduce:
1. Install clean Drupal 8.3.2 (simplytest.me)
2. Install and enable token, metatag, metatag_views
3. Go to /admin/config/search/metatag/views and click "add"
3. Try to add a metatag for a view.

After clicking the "Submit" button the following error appears:
InvalidArgumentException: The configuration property display.default.display_options.display_extenders.metatag_display_extender.metatags.robots.index doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

CommentFileSizeAuthor
#90 reenable-custom-views-admin-pages-2883718-90.patch20.26 KBRuedische
#89 reenable-custom-views-admin-pages-2883718-89.patch24.7 KBmetalbote
#86 interdiff-84-85.txt1.12 KBtrzcinski.t@gmail.com
#86 reenable-custom-views-admin-pages-2883718-85.patch23.3 KBtrzcinski.t@gmail.com
#85 interdiff-82-84.txt3.75 KBtrzcinski.t@gmail.com
#85 reenable-custom-views-admin-pages-2883718-84.patch23.18 KBtrzcinski.t@gmail.com
#83 interdiff-82-83.txt7.66 KBtrzcinski.t@gmail.com
#83 reenable-custom-views-admin-pages-2883718-83.patch16.21 KBtrzcinski.t@gmail.com
#82 interdiff_81-82.txt1.36 KBridhimaabrol24
#82 2883718-82.patch19.02 KBridhimaabrol24
#81 metatag-views_admin_pages-2883718-81.patch17.85 KBckaotik
#77 metatag-n2883718-77.patch17.81 KBsvetoslav.dragoev
#76 metatag-n2883718-76.patch18.35 KBsvetoslav.dragoev
#75 metatag-n2883718-75.patch18.35 KBsvetoslav.dragoev
#74 metatag-n2883718-74.patch28.51 KBsvetoslav.dragoev
#73 metatag-n2883718-73.patch12.87 KBsvetoslav.dragoev
#71 interdiff-69-71.txt3.12 KBFeyP
#71 n2883718-71.patch15.26 KBFeyP
#69 metatag-n2883718-69.patch13.25 KBbceyssens
#67 interdiff-65-67.txt4.93 KBckaotik
#67 metatag-custom_views_admin_ui-2883718-67.patch16.27 KBckaotik
#67 metatag-views_translation_ui-after.png66.76 KBckaotik
#67 metatag-views_translation_ui-before.png45.03 KBckaotik
#65 metatag-n2883718-65.patch13.42 KBChris Burge
#60 metatag-n2883718-60.patch14.08 KBDamienMcKenna
#60 metatag-n2883718-60-recover-files.patch3.44 KBDamienMcKenna
#52 metatag-n2883718-interdiff-20-52.interdiff.txt7.38 KBJaesin
#52 metatag-n2883718-52_rerollof20.patch10.73 KBJaesin
#48 metatag-reroll-n2883718-20.patch10.76 KBsassafrass
#20 metatag-n2883718-20.interdiff.txt672 bytesDamienMcKenna
#20 metatag-n2883718-20.patch13.72 KBDamienMcKenna
#20 metatag-n2883718-20.tests-only.patch672 bytesDamienMcKenna
#19 interdiff-2883718-5-19.txt2.9 KBjames.williams
#19 metatag-views_save_exception-2883718-19.patch13.07 KBjames.williams
#13 Peek 2017-06-09 14-00.gif2.49 MBrhormens
#9 metatag-n2883718-5.zip310.71 KBDamienMcKenna
#5 metatag-views_save_exception-2883718-5.patch10.25 KBckaotik

Issue fork metatag-2883718

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mytko Enko created an issue. See original summary.

idiaz.roncero’s picture

Exact same error here.

Mytko Enko’s picture

I have tried on clean installation on simplytest.me and nothing works. Strange that not so many people face that problem.

ckaotik’s picture

Assigned: Unassigned » ckaotik

I'm working on a fix for this, stay tuned :)

ckaotik’s picture

Assigned: ckaotik » Unassigned
Status: Active » Needs review
FileSize
10.25 KB

Please review the attached patch.

The problem was that the robots metatag needs processing before it can be saved. This processing was added to the ViewsDisplayExtender, but not to the custom administration forms that metatag_views provides. This is probably the reason why the error was not reported more widely.
You might need to update the base metatags before translating works correctly, I haven't tried that.

Mytko Enko’s picture

@ckaotik Thank you, I have tried to apply the patch... after pressing submit button page /meatags/view become unavailable, log message is:
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "metatag_views.metatags.translate_overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 190 of drupal\core\lib\Drupal\Core\Routing\RouteProvider.php).

ckaotik’s picture

Strange, the patch does not touch the routes at all. Have you rebuilt the cache after enabling metatag_views?

Mytko Enko’s picture

Yes, I've tried few times on different projects. Always use drush cr. Same problem. I think when I add a view metatag without editing there is "success" message, but nothing appears on the list. And when I add view metatag with values it crashes, and crashes every time I try to see the list of views metatags metatag/views

DamienMcKenna’s picture

FileSize
310.71 KB

@mytko: Please remove your current files from the metatag directory and expand this archive instead, then clear the caches and see if the problem persists. Thanks.

Mytko Enko’s picture

@DamienMcKenna: still the same Symfony\Component\Routing\Exception\RouteNotFoundException: Route "metatag_views.metatags.translate_overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 190 of drupal\core\lib\Drupal\Core\Routing\RouteProvider.php).

DamienMcKenna’s picture

Are you sure the Metatag Views module is still enabled?

rhormens’s picture

Assigned: Unassigned » rhormens
rhormens’s picture

Issue tags: +ciandt-contrib
FileSize
2.49 MB

Hi guys,

I can not reproduce the bug in these versions.

Please see screencast below.

metatag

rhormens’s picture

Assigned: rhormens » Unassigned
Status: Needs review » Needs work
ivavictoria’s picture

The "RouteNotFoundException" error happens to me on the Metatag Views page: /admin/config/search/metatag/views

Upon enabling the Metatag Views module, that page works fine.
But, after adding metatags to a view (as shown in the screencast in comment #13), if I try to re-visit the Metatag Views page, I get the error.

dietr_ch’s picture

I suspect the module has an implicit dependency to config_translation. MetatagViewsController does not seem to check it before trying to load the translations route.

Do you have config_translation enabled?

Dietrich

Mytko Enko’s picture

@rhormens thanks a lot for the gif. I have only tried to add view metatag on metatag's settings page drupalroot/admin/config/search/metatag/views (just like @Aurif3x) and it was crashing (and still crashing). But when I tried to ad it on actual view editing page it worked!

james.williams’s picture

Adding the metatag works fine now, but it's then on viewing the subsequent /admin/config/search/metatag/views page that the missing route error shows up, because one of the 'operations' links for each view is to the translate_overview page. That will only exist if the config_translation module is enabled (which it's not for me), so I agree with dietr_ch.

james.williams’s picture

Status: Needs work » Needs review
FileSize
13.07 KB
2.9 KB

Here's a patch :-)

DamienMcKenna’s picture

DamienMcKenna’s picture

It's kinda annoying that it's saying the branch tests fail when the default test instance for the 8.x-1.x branch is against 8.3.x, which fully pass, rather than the 8.4.x tests which fail. Grr. I've set the module tests against 8.3.x to rerun, so hopefully them passing will kick it back into gear.

DamienMcKenna’s picture

Ok, the tests are green. This is strange, though, as it was suggested the error was because the config translation module was required, which doesn't seem to be the case. Any thoughts?

greenmother’s picture

Thanks DamienMcKenna, patch worked for me.

DamienMcKenna’s picture

Before committing this I'd like to find exactly what is causing the failures. The tests-only fine in #20 isn't failing, so there's an additional aspect to this that I'm not catching quite yet. Any thoughts?

hdotnet’s picture

  • I received the error above after attempting to add a meta tag to a view via the admin/config/search/metatag/views route.
  • I managed to add a tag via Views UI
  • The added tags were not then visible via admin/config/search/metatag/views
  • I then applied patch #20
  • I could then see the added tag config in admin/config/search/metatag/views
  • I then got this when I clicked the edit button against the now visible entry in admin/config/search/metatag/views:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "metatag_views.metatags.translate_overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 190 of core/lib/Drupal/Core/Routing/RouteProvider.php).

Solved by uninstalling and reinstall metatags_views (with patch #20 still). So far seems to be working as expected.

HTH

DamienMcKenna’s picture

For anyone who hasn't fixed their site yet ;-) could you please test clearing your site's caches after applying the patch to see if the route error mentioned in #25 is still there or if the cache-clearing skips past that problem. Thanks.

ericshell’s picture

I ran into the same issue as #25 after applying the patch in #20.

Clearing the cache does not resolve the issue.

I uninstalled and reinstalled the views_metatags module (without reverting my configured displays) and it still did not work. The previously configured displays were still there after reinstallation. Reverting and recreating still produced the breaking error.

Reverting all displays before uninstalling and reinstalling and reconfiguring did not work either.

Full error when trying to edit a display:

The website encountered an unexpected error. Please try again later.


Symfony\Component\Routing\Exception\RouteNotFoundException: Route "metatag_views.metatags.translate_overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 190 of core/lib/Drupal/Core/Routing/RouteProvider.php).

I get this behavior for each display that I create.

eastdrive’s picture

Can confirm the same issue as #25 and #27

DamienMcKenna’s picture

Status: Needs review » Needs work

I've just spent some time testing Metatag Views on a copy of a production site with 8.3.4 that has translations running and have not run into any problems, and then did the same on both barebones 8.3.x and 8.4.x installations. None of the installations had any problems.

Both of the barebones installations had the latest core releases, they just had the "Standard" installation profile applied and then Token, Metatag and Metatag Views were installed. The production site last had its contrib modules updated in April-ish (CTools was still 8.x-3.0-alpha27).

This doesn't mean I do not believe you about there being a problem, it means I want to spend more time digging through to working out what the actual cause us so that we can have a test that demonstrates the error and then show how the patch fixes it.

hdotnet’s picture

I'm getting the exact same error out of the box

> drush dl drupal
Project drupal (8.3.5) downloaded to /var/www/html/drupal-8.3.5.                                        [success]
Project drupal contains:                                                                                [success]
 - 1 profile: standard
 - 14 themes: testing_config_import, testing_missing_dependencies, testing_multilingual_with_english,
minimal, testing_multilingual, testing_config_overrides, drupal_system_listing_compatible_test,
testing, stable, classy, bartik, twig, seven, stark
 - 73 modules: book, breakpoint, migrate, tour, block_place, link, content_translation, forum,
shortcut, ban, language, comment, datetime_range, responsive_image, config, options, tracker,
automated_cron, action, node, migrate_drupal_ui, serialization, field_layout, contextual,
dynamic_page_cache, datetime, search, dblog, text, system, path, statistics, syslog, menu_ui, file,
views_ui, hal, help, views, block_content, big_pipe, ckeditor, rdf, quickedit, history, taxonomy,
block, entity_reference, content_moderation, inline_form_errors, workflows, contact, color,
page_cache, editor, image, rest, aggregator, user, field_ui, toolbar, update, field,
menu_link_content, telephone, locale, outside_in, filter, simpletest, config_translation, basic_auth,
layout_discovery, migrate_drupal

> drush en metatag
> drush en metatag_views
[go to /admin/config/search/metatag/views/add enter some values and hit submit]
> drush ws --tail
 45  11/Jul 11:44  error   php     InvalidArgumentException: The configuration property                          
                                   display.page_1.display_options.display_extenders.metatag_display_extender.met 
                                   atags.robots.index doesn't exist. in Drupal\Core\Config\Sc
DamienMcKenna’s picture

Issue tags: +Needs tests

Oh wow, I hadn't noticed that entire section existed. Doh.

Yeah, that system needs some tests.

What I suggest doing for now is to add meta tags directly to the views themselves rather than via the separate config pages.

pacproduct’s picture

Was facing the same InvalidArgumentException kind of error when trying to enable 'follow, noindex' on my views. Patch #20 fixed the issue for me. Thanks!

danquah’s picture

I'm trying to track down the cause of an error I'm getting after upgrading to 8.4 and running drush updb. The pattern is exactly as described in https://www.drupal.org/node/2914958 (that is, I update core and then run drush updb), but the error-message I'm getting is identical to the one in the description of this issue (with the exception of the name of the view that is).

Any chance the two are related? Could there be something in 8.4 that provokes the this issue?

The patch in #20 does not help.

danquah’s picture

Just to clarify. The site I where getting the exception on has two views with a metatag configuration on a view. The site is currently running on (core) 8.3, and if I upgrade to 8.4 and do a drush updb I get the exception even with the patch from #20. The exception is thrown in the last part of update-db where core re-saves amongst other things all views.

The patch _does_ allow me to save the view manually both on 8.3 and 8.4. In other words, the patch seems to be handling the situation where the view is saved from the backend, but not the case where it is saved programmatically. The post update-db save of views seems to be handled from views_post_update_revision_metadata_fields() which triggers a $view->save() on all views on the site.

My current workaround to get the site upgraded is
- Save a copy of relevant metatag_display_extender sections in the views exported .yml files
- Remove the metatag configuration from the configuration
- Re-import the configuration
- Upgrade to 8.4 and run the update-hooks
- Reapply the metatag_display_extender configurations

This way I get a site that works just fine just as long as no-one saves any views programatically :)

Look forward to progress on this issue, please advice if I can help with eg. more tests.

james.williams’s picture

Hi @danquah, please can you confirm exactly what the error message you get is?

danquah’s picture

Ah yes, sure thing:

Failed: InvalidArgumentException: The configuration property display.overview.display_options.display_extenders.metatag_display_extender.metatags.robots.index doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of /var/www/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
danquah’s picture

And just to set the context, the view in question has a display called "overview" which is why the config-string reads "display.overview" and not "display.default" as the one in the description of this issue.

ckaotik’s picture

The error means that the data the system is trying to save for the robots metatag (likely the array ['index' => 'index'] as created by the checkboxes form element) does not match the configuration schema (which expects a string 'index').

This is ususally the case if form values are stored directly, without processing by the MetatagTagManager. We do this when saving the core View form or the metatag specific form, using the following checks:

      foreach ($metatags as $tag_id => $tag_value) {
        // Some plugins need to process form input before storing it.
        // Hence, we set it and then get it.
        $tag = $this->metatagTagManager->createInstance($tag_id);
        $tag->setValue($tag_value);
        if (!empty($tag->value())) {
          $tag_values[$tag_id] = $tag->value();
        }
      }

If you run into this error when running update scripts, you either had a broken configuration before updating the view, or we missed a way of saving the view. The views_post_update_revision_metadata_fields update hook only re-saves the View using Entity::save, we should be able to handle that.
I am wondering ... is your View translated, and have you maybe just edited one language version but one of the others still contains invalid values?

danquah’s picture

The site does have translation and configuration translation enabled, but I just checked and we only have a configuration for that view in the "root" configuration folder and not in the language/da subfolder. Might that be a problem?

With regards to the view already being broken, it might very well be, anything in particular I should be looking for in the config export (I can also attach the .yml if it helps and is relevant for the issue).

As far as I can tell from our SCM we where running metatag 1.0-beta12 when the configuration for that view was last exported, so that might also be a source of the problem.

That being said, I still get the Exception if I apply the patch from #20, export the configuration, and then upgrade to core 8.4 and run updb....

ckaotik’s picture

we only have a configuration for that view in the "root" configuration folder and not in the language/da subfolder. Might that be a problem?

That shouldn't be a problem.

With regards to the view already being broken, it might very well be, anything in particular I should be looking for in the config export

If you could post the metatag_display_extender section, that might help.

danquah’s picture

Here you go

views.view.badges.yml:

display
...
  overview:
...
    display_options:
      display_extenders:
        metatag_display_extender:
          metatags:
            title: '[ddsdk:badge-overview-title]'
            description: '[ddsdk:badge-overview-description]'
            abstract: ''
            keywords: ''
            geo_placename: ''
            geo_position: ''
            geo_region: ''
            icbm: ''
            canonical_url: ''
            content_language: ''
            robots:
              index: 0
              follow: 0
              noindex: 0
              nofollow: 0
              noarchive: 0
              nosnippet: 0
              noodp: 0
              noydir: 0
              noimageindex: 0
              notranslate: 0
            shortlink: ''
            news_keywords: ''
            standout: ''
            generator: ''
            image_src: '[ddsdk:badge-overview-topimage]'
            original_source: ''
            referrer: ''
            rights: ''
            og_determiner: ''
            og_site_name: ''
            og_type: ''
            og_url: '[current-page:url]'
            og_title: '[ddsdk:badge-overview-title]'
            og_description: '[ddsdk:badge-overview-description]'
            og_image: '[ddsdk:badge-overview-topimage]'
            og_video: ''
            og_image_url: ''
            og_image_secure_url: ''
            og_video_secure_url: ''
            og_image_type: ''
            og_video_type: ''
            og_image_width: ''
            og_video_width: ''
            og_image_height: ''
            og_video_height: ''
            og_updated_time: ''
            og_latitude: ''
            og_longitude: ''
            og_see_also: ''
            og_street_address: ''
            og_locality: ''
            og_region: ''
            og_postal_code: ''
            og_country_name: ''
            og_email: ''
            og_phone_number: ''
            og_fax_number: ''
            og_locale: ''
            og_locale_alternative: ''
            article_author: ''
            article_publisher: ''
            article_section: ''
            article_tag: ''
            article_published_time: ''
            article_modified_time: ''
            article_expiration_time: ''
            fb_admins: ''
            fb_pages: ''
            fb_app_id: ''
      path: maerker
      display_description: ''
ckaotik’s picture

Yeah, that's definitely the broken structure that was used while we were still working on the metatag_views feature (see #2563647-105: Views integration). To fix it, you can repeat what @Peacog did or directly edit your View's configuration and change the robots part to just robots: ''. To edit, you can use Devel's "Config Editor" feature or the core import/export.
Re-submitting the metatag part on the View or in the separate metatag form might also work.

danquah’s picture

That did the trick. I removed the metatag section from the view, configured it manually again and did an export. The newly exported configuration survived the updatedb without any problems.

Thanks! :)

ckaotik’s picture

So, we're now back to #31: Adding tests for the Metatag custom UI at /admin/config/search/metatag/views.

Anas_maw’s picture

I can confirm patch 20 worked for me, thanks.

mpark’s picture

It's horrible that this patch isn't still included in the module. This is a default necessary.

sassafrass’s picture

Using Drupal 8.4.3, I applied this patch (#20) to the latest dev branch of Metatag and got the following error on my site:
Fatal error: Class 'Drupal\metatag\Plugin\Field\FieldType\MetatagFieldItem' not found in mysite/docroot/core/modules/field/src/FieldStorageConfigStorage.php on line 159.

Disregard the above error, it was because the patch would not apply to the metatag dev version I was trying to apply it to.

I applied the patch manually, and it fixed the issue. However, the patch does need to be re-rolled if used against the latest dev branch.

sassafrass’s picture

The attached patch is my version of #20 re-rolled against the latest dev version that I downloaded via git clone.

mpark’s picture

Thanks :-)

DamienMcKenna’s picture

Status: Needs work » Needs review

Lets check in with the testbot again.

Status: Needs review » Needs work

The last submitted patch, 48: metatag-reroll-n2883718-20.patch, failed testing. View results

Jaesin’s picture

chegor’s picture

Looks ok.

ABaier’s picture

I can also confirm this issue.

I could not create metatags for views from /admin/config/search/metatag/views, which resulted in the error from the issue's description. After successfully adding some metatags from the views UI the config page /admin/config/search/metatag/views was not available anymore resulting in the error from #10.

The patch from #52 applied against 8.x-1.4 and brought the config page back, showing me the view overridden from within the views UI, but still gives me the error after trying to edit it using the dropbutton.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "metatag_views.metatags.translate_overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (Zeile 190 in /Applications/MAMP/htdocs/mypage/htdocs/core/lib/Drupal/Core/Routing/RouteProvider.php).
Niklan’s picture

Confirm the issue. Patch #52 is not fix it. When I press apply, AJAX returns 500 error:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "website" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php). 
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('website') (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('website', Array) (Line: 84)
Drupal\Component\Plugin\PluginManagerBase->createInstance('website') (Line: 104)
Drupal\metatag_views\Plugin\views\display_extender\MetatagDisplayExtender->submitOptionsForm(Array, Object) (Line: 2004)
Drupal\views\Plugin\views\display\DisplayPluginBase->submitOptionsForm(Array, Object) (Line: 476)
Drupal\views\Plugin\views\display\PathPluginBase->submitOptionsForm(Array, Object) (Line: 467)
Drupal\views\Plugin\views\display\Page->submitOptionsForm(Array, Object) (Line: 109)
Drupal\views_ui\Form\Ajax\Display->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 255)
Drupal\views_ui\ViewUI->standardSubmit(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('views_ui_edit_display_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('views_ui_edit_display_form', Object) (Line: 212)
Drupal\views_ui\Form\Ajax\ViewsFormBase->Drupal\views_ui\Form\Ajax\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 214)
Drupal\views_ui\Form\Ajax\ViewsFormBase->ajaxFormWrapper('Drupal\views_ui\Form\Ajax\Display', Object) (Line: 123)
Drupal\views_ui\Form\Ajax\ViewsFormBase->getForm(Object, 'list', 'ajax') (Line: 44)
Drupal\views_ui\Form\Ajax\Display->getForm(Object, 'list', 'ajax', 'metatags')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
joerch’s picture

subscribe

Confirm the described issue.

ckaotik’s picture

We've strayed quite a bit from the original report, so I'll try to summarize what we've discovered so far.

  1. The original issue was related to a schema change for robots
    This was fixed in #5.
  2. Then a routing error with metatag_views.metatags.translate_overview popped up in #6
    This was due to an assumption that the config_translation is always available (it's not) and has been addressed in various patches since then, #52 being the most recent.
  3. Now we have a website plugin error in #55
    This has not been addressed yet. We should first figure out if this is related, or maybe a different issue altogether.

This whole issue is further complicated by the fact that there are two locations for configuring views metatags, and thus two locations for translating them.

  1. The standalone metatag configuration
    at /admin/config/search/metatag/views/{VIEW_ID}/{DISPLAY_ID}/edit
    and translation at /admin/config/search/metatag/views/{VIEW_ID}/{DISPLAY_ID}/translate if using config_translation
  2. The view configuration
    at /admin/structure/views/view/{VIEW_ID}/edit/{DISPLAY_ID} in the middle column under "Meta-Tags"
    and translation at /admin/structure/views/view/{VIEW_ID}/translate if using config_translation

To further investigate the issue, please post which error you encounter, and under which conditions (which config form, with or without config_translation etc.). Please also be aware that modules that extend the metatag tags might influence your problem. Otherwise we might never get to the bottom of this.

DamienMcKenna’s picture

Title: Error on attempt to add view metatags » Errors on /admin/config/search/metatag/views/add

Clarifying the problem to make it easier to find as it keeps coming up.

DamienMcKenna’s picture

FYI I'm working to hide the separate Metatag-Views admin pages in #2956199: Remove separate admin pages for Views integration, as a way of avoiding this problem until we can fix it properly.

DamienMcKenna’s picture

Just to be clear: the next release (8.x-1.5) will not have the separate admin pages for managing configurations for Views as a temporary solution until we can fix this issue.

Here are two patches - one file just recovers the removed Yaml files, and another combines that with the patch from #52.

DamienMcKenna’s picture

I split off the test change from #20 into #2956227: Test improvements from 2883718-20 because as-is it's not really related to this problem.

DamienMcKenna’s picture

Status: Needs review » Needs work

Thinking out loud here - does anyone actually want to use the separate Views admin pages or should we just replace it with a single configurable default listed on the main defaults page, then leave the individual views to be managed on their own?

ckaotik’s picture

Personally, having a separate config just for the metatags allows us to pass setting up metatags (or translating them) to project management or in some cases even to the client themselves. We wouldn't give either access to edit our views, as there's a lot more that could go wrong.

DamienMcKenna’s picture

Title: Errors on /admin/config/search/metatag/views/add » Reenable custom Views admin pages
Issue summary: View changes

@ckaotik: Ok, that's a valid use case.

Lets focus this on just making all those pages work properly again.

Chris Burge’s picture

Rerolled #60 against HEAD. It looks like the following code is already committed (which causes #60 to fail to apply):

diff --git a/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php b/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php
index ed221c9..3aa3e80 100644
--- a/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php
+++ b/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php
@@ -131,6 +131,11 @@ public function testSiteStillWorks() {
 
     // Confirm what the page title looks like now.
     $this->assertTitle('Metatag title');
+
+    // Load the Metatag admin page to confirm it still works.
+    $this->drupalGet('admin/config/search/metatag');
+    $this->assertResponse(200);
+    $this->assertText('Add default meta tags');
   }
 
 }
DamienMcKenna’s picture

Thanks @ChrisBurge.

ckaotik’s picture

Thanks @ChrisBurge for the reroll!

I've a suggestion to make: How about we use the default metatag translation ui that editors already know from content edit forms? I've attached a patch and some before/after screenshots for how this could work (unless I've messed up the patch file). This would allow for more complex form elements by providers and allows to use the regular tag groups.
Groups for tags that have not been set in the original language are displayed but without any inputs - or we could of course remove those groups. We could also disable the original language, but either way changes on that side of the form are not saved. We could also apply this to the views ui.

How do you feel about this? (we can always fallback to #65)

DamienMcKenna’s picture

bceyssens’s picture

Rerolled #65 against 8.x-1.7. Parts of the code have been moved or are already committed.

Ruedische’s picture

Thank you for the patch. Unfortunately, we still had a few problems: Originally we were using Metatag 8.x-1.2 and enabled metatag_views when we got the error message shown in the issue summary. We then updated to metatag 8.x-1.7 and applied the patch from #2883718-69: Reenable custom Views admin pages. After clearing all caches, the views tab appeared on the metatag settings page and we were able to add a new configuration for a view. After adding a configuration, we were redirected to the views tab and got a success message, but the configuration did not appear on the page. Also, the metatags we configured were not added to the view in question. We cleared all caches again, but that didn't help. Upon looking at a configuration export, we saw that the metatags we configured were successfully added to the views configuration. We then uninstalled the metatag_views module and enabled it again immediately. Now, the configuration we added earlier was displayed on the views tab and the metatags were visible on the views page as configured. When we exported the configuration again, an update was shown for the views.settings.yml. Is the patch maybe missing an update hook to work with earlier existing installations of metatag_views?

FeyP’s picture

With the patch in #69 I get a RouteNotFoundException: Route "metatag_views.metatags.translate_overview" does not exist. when editing metatag_views configuration, if the config_translation module is not enabled. Attached is a patch to fix this. #70 still needs to be addressed, though.

james.williams’s picture

Thanks FeyP, that works well for me. It's interesting that the local task didn't used to cause the problem in the same way; but I could totally imagine something has changed in Drupal/Symfony's route/task handling since my patch back in #19.

svetoslav.dragoev’s picture

Rerolled #71 against 8.x-1.9.

svetoslav.dragoev’s picture

Rerolled #71 against 8.x-1.9.

Sorry, #73 was not fully exported.

svetoslav.dragoev’s picture

Rerolled #71 against 8.x-1.9 - full.

svetoslav.dragoev’s picture

Rerolled #71 against 8.x-1.9. Missing empty line at the end of patch fix.

svetoslav.dragoev’s picture

FileSize
17.81 KB

Rerolled #71 against 8.x-1.9.

arsn’s picture

#77 seems to work however displays a duplicate admin/config/search/metatag tab.

Here in French:

Only local images are allowed.

DamienMcKenna’s picture

Status: Needs review » Needs work

So, I think this is back to the olde Needs Tests thing. With test coverage we can plan out exactly what we expect to happen, then make sure the code does that.

rynnnner’s picture

This patch doesn't install for me on 8.x-1.13.

ckaotik’s picture

Rerolled for 8.x-1.13, still needs tests.

ridhimaabrol24’s picture

Status: Needs work » Needs review
FileSize
19.02 KB
1.36 KB

Added a functional test as per the steps to reproduce. Please review!

trzcinski.t@gmail.com’s picture

I have been testing the UI and the translation tab for views meta-tags does not work. It throws like this:
Error: Call to undefined method Symfony\Component\HttpFoundation\RequestStack::get() in Drupal\metatag_views\Controller\MetatagViewsTranslationController->itemPage() (line 85 of modules/contrib/metatag/metatag_views/src/Controller/MetatagViewsTranslationController.php).

The reason is this commit:
https://git.drupalcode.org/project/metatag/-/commit/f76d3fa9008bd91bd18c...

which replaces

    $view_id = \Drupal::request()->get('view_id');
    $display_id = \Drupal::request()->get('display_id');

with:

    $view_id = $this->requestStack->get('view_id');
    $display_id = $this->requestStack->get('display_id');

in metatag_views/src/Controller/MetatagViewsTranslationController.php

$this->requestStack is instantiated like this: $container->get('request_stack') in the create method of the controller, whereas \Drupal::request() is actually doing this:

  public static function request() {
    return static::getContainer()->get('request_stack')->getCurrentRequest();
  }

The patch simply adds the ->getCurrentRequest() part in the controller as well as a simple test just for this case. It also adds a helper method to the trait to create a view (might be helpful for other tests).

There are still more tests to be written, but just adding a small brick :).

Status: Needs review » Needs work

The last submitted patch, 83: reenable-custom-views-admin-pages-2883718-83.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

trzcinski.t@gmail.com’s picture

I did not add the new files to the patch... Reuploading.

trzcinski.t@gmail.com’s picture

I have fixed the doubled tabs problem - it was caused by the duplicated entries in the yaml files. Also added Views to the menu (next to Global and Settings).

The last submitted patch, 85: reenable-custom-views-admin-pages-2883718-84.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 86: reenable-custom-views-admin-pages-2883718-85.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

metalbote’s picture

Ruedische’s picture