commit 26a949d900be7b75f863098a2182f7255bd83e80 Author: Francesco Placella Date: Wed Jan 28 01:13:27 2015 +0100 Remove obsolete field language query option. diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 2053e47..d1bf24b 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -584,9 +584,6 @@ protected function defineOptions() { 'rendering_language' => array( 'default' => '***LANGUAGE_entity_translation***', ), - 'field_langcode_add_to_query' => array( - 'default' => TRUE, - ), // These types are all plugins that can have individual settings // and therefore need special handling. @@ -1624,11 +1621,6 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { '#description' => $this->t('All content that supports translations will be displayed in the selected language.'), '#default_value' => $this->getOption('rendering_language'), ); - $form['field_langcode_add_to_query'] = array( - '#type' => 'checkbox', - '#title' => $this->t('When needed, add the field language condition to the query'), - '#default_value' => $this->getOption('field_langcode_add_to_query'), - ); } else { $form['rendering_language']['#markup'] = $this->t("You don't have translatable entity types."); @@ -1950,7 +1942,6 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) { break; case 'rendering_language': $this->setOption('rendering_language', $form_state->getValue('rendering_language')); - $this->setOption('field_langcode_add_to_query', $form_state->getValue('field_langcode_add_to_query')); break; case 'use_ajax': case 'hide_attachment_summary': diff --git a/core/modules/views/src/Plugin/views/field/Field.php b/core/modules/views/src/Plugin/views/field/Field.php index d0c8e46..48063dc 100644 --- a/core/modules/views/src/Plugin/views/field/Field.php +++ b/core/modules/views/src/Plugin/views/field/Field.php @@ -11,7 +11,6 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldTypePluginManagerInterface; use Drupal\Core\Field\FormatterPluginManager; @@ -22,7 +21,6 @@ use Drupal\Core\Render\Element; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Session\AccountInterface; -use Drupal\field\FieldStorageConfigInterface; use Drupal\field\Views\FieldAPIHandlerTrait; use Drupal\views\Entity\Render\EntityTranslationRenderTrait; use Drupal\views\Plugin\CacheablePluginInterface; @@ -271,19 +269,6 @@ public function query($use_groupby = FALSE) { if ($this->add_field_table($use_groupby)) { $this->ensureMyTable(); $this->addAdditionalFields($fields); - - // If we are grouping by something on this field, we want to group by - // the displayed value, which is translated. So, we need to figure out - // which language should be used to translate the value. See also - // $this->fieldLangcodeAvailable(). - $field = $field_definition; - if ($field->isTranslatable() && !empty($this->view->display_handler->options['field_langcode_add_to_query'])) { - $column = $this->tableAlias . '.langcode'; - $langcode = $this->fieldLangcodeConfigured(); - $placeholder = $this->placeholder(); - $langcode_fallback_candidates = $this->languageManager->getFallbackCandidates(array('langcode' => $langcode, 'operation' => 'views_query', 'data' => $this)); - $this->query->addWhereExpression(0, "$column IN($placeholder) OR $column IS NULL", array($placeholder => $langcode_fallback_candidates)); - } } $this->getEntityTranslationRenderer()->query($this->query); diff --git a/core/modules/views_ui/src/Tests/ViewEditTest.php b/core/modules/views_ui/src/Tests/ViewEditTest.php index 2a60a50..c34da2d 100644 --- a/core/modules/views_ui/src/Tests/ViewEditTest.php +++ b/core/modules/views_ui/src/Tests/ViewEditTest.php @@ -135,7 +135,6 @@ public function testEditFormLanguageOptions() { } else { $this->assertFieldByName('rendering_language', '***LANGUAGE_entity_translation***'); - $this->assertFieldByName('field_langcode_add_to_query', TRUE); } } }