Commit dc164770 authored by catch's avatar catch

Issue #1932806 by ACF: Change entity_form_langcode() to the state system.

parent b5f0af34
......@@ -67,7 +67,7 @@ function testEntityFormLanguage() {
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalGet('node/add/page');
$form_langcode = variable_get('entity_form_langcode', FALSE);
$form_langcode = state()->get('entity_test.form_langcode') ?: FALSE;
$this->drupalPost(NULL, $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit["title"]);
......@@ -75,14 +75,14 @@ function testEntityFormLanguage() {
// Edit the node and test the form language.
$this->drupalGet($this->langcodes[0] . '/node/' . $node->nid . '/edit');
$form_langcode = variable_get('entity_form_langcode', FALSE);
$form_langcode = state()->get('entity_test.form_langcode') ?: FALSE;
$this->assertTrue($node->langcode == $form_langcode, 'Form language is the same as the entity language.');
// Explicitly set form langcode.
$langcode = $this->langcodes[0];
$form_state['langcode'] = $langcode;
entity_get_form($node, 'default', $form_state);
$form_langcode = variable_get('entity_form_langcode', FALSE);
$form_langcode = state()->get('entity_test.form_langcode') ?: FALSE;
$this->assertTrue($langcode == $form_langcode, 'Form language is the same as the language parameter.');
// Enable language selector.
......@@ -117,7 +117,7 @@ function testEntityFormLanguage() {
$node->body[$langcode2][0]['value'] = $this->randomName(16);
$node->save();
$this->drupalGet($langcode2 . '/node/' . $node->nid . '/edit');
$form_langcode = variable_get('entity_form_langcode', FALSE);
$form_langcode = state()->get('entity_test.form_langcode') ?: FALSE;
$this->assertTrue($langcode2 == $form_langcode, "Node edit form language is $langcode2.");
}
}
......@@ -147,7 +147,7 @@ function entity_test_menu() {
*/
function entity_test_form_node_form_alter(&$form, &$form_state, $form_id) {
$langcode = $form_state['controller']->getFormLangcode($form_state);
variable_set('entity_form_langcode', $langcode);
state()->set('entity_test.form_langcode', $langcode);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment