I'm having an issue where after saving a metatag on a panelized page, it will correctly save, but upon editing again the value in the form is set to the global defaults instead of our local changes.

After some debugging, it looks like the panelized page is passing 'en' as the $langcode into metatag_field_attach_form, but the actual data is stored in 'und'. This causes the raw data to save in the $metatags array (as shown in the attached screenshot).

I don't have any multilingual modules or anything on my site, and I'm not sure where to go from here. Adding $metatags = $entity->metatags[LANGUAGE_NONE]; as the fallback condition would solve my issue, but I don't know if this would break anything somewhere else.

Any thoughts?

CommentFileSizeAuthor
debug_metatag.png24.55 KBbkildow
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Seeing as I'm the maintainer of both modules, I'm really interested to know why this is happening. Are you using the latest dev release of Panelizer? Have you customized the node form using Panels, or is it the normal node edit form?

bkildow’s picture

I'm using panelizer that comes with the panopoly distribution (7.x-3.1). I just tried the dev version, and the same issue appears. I am using a customized node form using panels, close to what panoply provides. Is there a way to configure what language the form should be saved in from panels?

DamienMcKenna’s picture

Title: Panelizer not passing the correct langcode » Custom Panels entity edit form not passing the correct langcode
Component: Code » Panels integration
Issue tags: +panopoly

I suspect the problem is in the way the custom Panels edit form is doing its work, rather than Metatag's entity handling. I'll take a look at this shortly.

DamienMcKenna’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
bkildow’s picture

I dug into this a bit more, and I think I figured out the main issue. It turns out I had the "locale" module enabled, and upon disabling this, NEW content correctly saved the metatags. Looking in the database in the node table, new content is now saved with the langcode "und". When the locale module was enabled, content was being saved with the langcode "en".

Once the locale module was disabled however, saving existing content kept whatever langcode the content was originally set to (in my case "en"), and metatags never saved.

DamienMcKenna’s picture

Does the problem still exist with the latest 1.5-beta1 release?

DamienMcKenna’s picture

Status: Active » Postponed (maintainer needs more info)
DamienMcKenna’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

I believe this should be a-ok now, but please re-open it if the problem persists.