Updated: Comment #N

Problem/Motivation

Go to edit any view, under "Advanced tab" click on "Field language" options.. You will get an empty form. This form also throws errors by assuming all entity info items will have a base table.

Proposed resolution

The DisplayPluginBase buildOptionsForm switch statement is for 'field_language' but the link (and other places) have been changed to 'field_langcode'. Change this switch case to 'field_langcode'

Remaining tasks

Review fix, tests

User interface changes

A fixed Field language form.

API changes

None

Files: 
CommentFileSizeAuthor
#15 langcode.jpg243.06 KBivanjaros
#2 2087069-2-tests-only.patch1.75 KBdamiankloip
FAILED: [[SimpleTest]]: [MySQL] 58,988 pass(es), 9 fail(s), and 2 exception(s).
[ View ]
#2 2087069-2.patch3.64 KBdamiankloip
PASSED: [[SimpleTest]]: [MySQL] 59,237 pass(es).
[ View ]
#1 2087069.patch1.16 KBdamiankloip
FAILED: [[SimpleTest]]: [MySQL] Setup environment: failed to create checkout database.
[ View ]

Comments

StatusFileSize
new1.16 KB
FAILED: [[SimpleTest]]: [MySQL] Setup environment: failed to create checkout database.
[ View ]

Here is a fix, haven't got round to the tests yet.

Status:Active» Needs review
Issue tags:-Needs tests
StatusFileSize
new3.64 KB
PASSED: [[SimpleTest]]: [MySQL] 59,237 pass(es).
[ View ]
new1.75 KB
FAILED: [[SimpleTest]]: [MySQL] 58,988 pass(es), 9 fail(s), and 2 exception(s).
[ View ]

Ok, changed the logic a bit as it seems pretty flaky at the moment. It basically only works in a normal install because the custom_block entity type have an item in it's 'translation' array in entity_info. So it seems like the $has_translation_handlers is not really working as it should? I've changed this to check the 'translatable' key in entity_info instead, and only add tables to the array that are translatable, then check against that.

Thoughts?

Status:Needs review» Needs work
Issue tags:-VDC

The last submitted patch, 2087069-2.patch, failed testing.

Status:Needs work» Needs review

#2: 2087069-2.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, 2087069-2.patch, failed testing.

Status:Needs work» Needs review

#2: 2087069-2.patch queued for re-testing.

Issue tags:+VDC

#2: 2087069-2-tests-only.patch queued for re-testing.

Status:Needs review» Reviewed & tested by the community

This seems to be a patch which could be backported to d7?

Status:Reviewed & tested by the community» Fixed

Committed dfce8c0 and pushed to 8.x. Thanks!

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

Issue summary:View changes

Updated issue summary.

Issue summary:View changes

I have a custom entity with custom fields displaying in Views and I'm getting this notice:

Notice: Undefined index: field_language in Drupal\field\Plugin\views\field\Field->field_langcode() (line 861 of core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php).

There is 'field_langcode' but not 'field_language' key in Drupal\field\Plugin\views\field\Field->view->display_handler->options array with " ***CURRENT_LANGUAGE***" as value.

If I rename the 'field_language' to 'field_langcode' I get:

Recoverable fatal error: Object of class Drupal\Core\Language\Language could not be converted to string in Drupal\field\Plugin\views\field\Field->field_langcode() (line 862 of core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php).

Could this be the same issue?

Status:Closed (fixed)» Active

BTW: the error is triggered by 'body' field. Here is the config:

id: myentity.body
uuid: ...
status: true
langcode: en
name: body
entity_type: myentity
type: text_with_summary
settings: {  }
module: text
locked: true
cardinality: 1
translatable: true
indexes: {  }

And here is how the instance is created:

$instance = Field::fieldInfo()->getInstance($entity_type, $bundle, 'body');
  if (empty($instance)) {
    entity_create('field_instance_config', array(
      'field_name' => 'body',
      'entity_type' => $entity_type,
      'bundle' => $bundle,
      'label' => 'Body',
      'description' => 'Describe this entry.',
      'settings' => array('display_summary' => TRUE, 'text_processing' => 1),
    ))->save();
    entity_get_form_display($entity_type, $bundle, 'default')
      ->setComponent('body', array('type' => 'text_textarea_with_summary'))
      ->save();
    entity_get_display($entity_type, $bundle, 'default')
      ->setComponent('body', array('label' => 'hidden', 'type' => 'text_default', 'weight' => 0))
      ->save();
  }

StatusFileSize
new243.06 KB

And this is content of /core\modules\field\lib\Drupal\field\Plugin\views\field\Field->view->display_handler->options

dsm

I've noticed that the field.field.node.body.yml has 'translatable' set to false. That's probably why my body is throwing errors and node is not.

Status:Active» Fixed

Please open a follow up and not reopen an existing issue. Thank you!

Sure, I just wasn't sure if this is the same issue or not.