Skip to content

Commit

Permalink
Issue #3131388 by penyaskito: Visiting the config translation listing…
Browse files Browse the repository at this point in the history
… of fields you get a WSOD

(cherry picked from commit d44afee50b39414a55cf4d0b9795883932f0b31a)
  • Loading branch information
catch committed Apr 28, 2020
1 parent 6d59517 commit cbfb75a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ class ConfigTranslationFieldListBuilder extends ConfigTranslationEntityListBuild
*/
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
$entity_type_manager = $container->get('entity_type.manager');
$entity_type_bundle_info = $container->get('entity_type.bundle.info');
return new static(
$entity_type,
$entity_type_manager->getStorage($entity_type->id()),
$entity_type_manager
$entity_type_manager,
$entity_type_bundle_info
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
namespace Drupal\Tests\config_translation\Functional;

use Drupal\Component\Utility\Html;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\BrowserTestBase;

/**
Expand All @@ -26,6 +29,8 @@ class ConfigTranslationOverviewTest extends BrowserTestBase {
'contact',
'contextual',
'entity_test_operation',
'field_ui',
'node',
'views',
'views_ui',
];
Expand Down Expand Up @@ -171,4 +176,31 @@ public function testListingPageWithOverrides() {
$this->assertNoText($overridden_label);
}

/**
* Tests the field listing for the translate operation.
*/
public function testListingFieldsPage() {
// Create a content type.
$node_type = NodeType::create([
'type' => 'basic',
'name' => 'Basic',
]);
$node_type->save();

$field = FieldConfig::create([
// The field storage is guaranteed to exist because it is supplied by the
// node module.
'field_storage' => FieldStorageConfig::loadByName('node', 'body'),
'bundle' => $node_type->id(),
'label' => 'Body',
'settings' => ['display_summary' => FALSE],
]);
$field->save();

$this->drupalGet('admin/config/regional/config-translation/node_fields');
$this->assertText('Body');
$this->assertText('Basic');
$this->assertLinkByHref('admin/structure/types/manage/basic/fields/node.basic.body/translate');
}

}

0 comments on commit cbfb75a

Please sign in to comment.