With the changes in #2334439: Switch "Content Item" widget to use some kind of entity reference field rather than title with autocomplete filter to use nid versus title, we are closer to supporting multilingual features in Panopoly's "Add content item" widget! However, one thing I noticed, is the View needs to be overridden to filter on the current user's language to support locale.

The "Content: Language" filter doesn't seem to be available if the module isn't enabled. So we'll need to add it via defaults_alter()

/* Filter criterion: Content: Language */
$handler->display->display_options['filters']['language']['id'] = 'language';
$handler->display->display_options['filters']['language']['table'] = 'node';
$handler->display->display_options['filters']['language']['field'] = 'language';
$handler->display->display_options['filters']['language']['value'] = array(
  '***CURRENT_LANGUAGE***' => '***CURRENT_LANGUAGE***',
);
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mglaman’s picture

Assigned: mglaman » Unassigned

Accidentally assigned to self. Unassigning in case I can't get to this before someone else :)

mglaman’s picture

Status: Active » Needs review
FileSize
1.32 KB

Patch attempt!

dsnopek’s picture

Thanks! Given I don't usually test with multilingual, it would be super awesome to get a Behat test for this! Otherwise, we're prone to break it at some point down the road. It's not a requirement to review and commit it, though, we can always make a follow-up issue.

mglaman’s picture

I wonder if we could work in a subset of Behat tests around multilingual? Like even a panopoly_i18n which pulled in the monster amount of contrib required and had its own Behat tests.

dsnopek’s picture

Yeah, I think a panopoly_i18n app would be a great idea in general, even without the Behat angle!

mglaman’s picture

Issue summary: View changes
FileSize
107.86 KB

I found a quirk. I don't know if it should knock this or not, considering the reasoning it's here. If content types have not been configured to have multilingual support then they can't be found with the "Add content item" widget.

Also, if a node is saved as "Language Neutral" it can't be reference. Apparently that filter is strict to the language code and doesn't have LANGUAGE_NONE forgiveness. But, given the reasoning you'd have Locale enabled I'm not sure if this is a deal breaker or not.

Example: If you have Locale enabled it's assumed you are specifying specific language versions of nodes. Embedding nodes without that would not be translated, which means they can't be added. This ensures you are not embedding references to nodes which are not yet translated.

dsnopek’s picture

Hm. There has to be a way to configure Views to show both (a) nodes matching the currently selected language, or (b) nodes with LANGUAGE_NONE. Even on a multilingual site, not all node types are going to be translatable...

mglaman’s picture

FileSize
1.34 KB

Here is updated patch which supports node without a defined language! Fixes the one issue :)

dsnopek’s picture

Issue tags: +sprint

Adding to the sprint

dsnopek’s picture

  • dsnopek committed 99629e3 on 7.x-1.x
    Update Panopoly Widgets for Issue #2458677 by mglaman: Add locale...
dsnopek’s picture

Status: Needs review » Fixed

Tests passed! I didn't do any manually testing, but I'm going to trust you on this one, @mglaman. :-) Commited!

Status: Fixed » Closed (fixed)

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

Andrew Edwards’s picture