Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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***',
);
Comment | File | Size | Author |
---|---|---|---|
#8 | add_locale_language-2458677-8.patch | 1.34 KB | mglaman |
#6 | Screen Shot 2015-03-24 at 4.10.36 PM.png | 107.86 KB | mglaman |
Comments
Comment #1
mglamanAccidentally assigned to self. Unassigning in case I can't get to this before someone else :)
Comment #2
mglamanPatch attempt!
Comment #3
dsnopekThanks! 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.
Comment #4
mglamanI 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.
Comment #5
dsnopekYeah, I think a panopoly_i18n app would be a great idea in general, even without the Behat angle!
Comment #6
mglamanI 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.
Comment #7
dsnopekHm. 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...
Comment #8
mglamanHere is updated patch which supports node without a defined language! Fixes the one issue :)
Comment #9
dsnopekAdding to the sprint
Comment #10
dsnopekRunning the tests on Travis:
https://travis-ci.org/panopoly/panopoly/builds/63694547
Comment #12
dsnopekTests passed! I didn't do any manually testing, but I'm going to trust you on this one, @mglaman. :-) Commited!
Comment #14
Andrew Edwards CreditAttribution: Andrew Edwards commented