Commit 33826d87 authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2920766 by borisson_, Niklan: Facets label in administrative interface shows original value

parent 4ea9a78c
......@@ -104,6 +104,9 @@ class FacetListBuilder extends DraggableListBuilder {
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\facets\FacetInterface $entity */
$facet = $entity;
$facet_configs = \Drupal::entityTypeManager()
->getStorage('facets_facet')
->load($facet->getConfigTarget());
$row = [
'type' => [
'#theme_wrappers' => [
......@@ -116,7 +119,7 @@ class FacetListBuilder extends DraggableListBuilder {
],
'title' => [
'#type' => 'link',
'#title' => $facet->label(),
'#title' => $facet_configs->get('name'),
'#suffix' => '<div>' . $entity->getFieldAlias() . ' - ' . $facet->getWidget()['type'] . '</div>',
'#attributes' => [
'class' => ['search-api-title'],
......
......@@ -204,4 +204,20 @@ class LanguageIntegrationTest extends FacetsTestBase {
$this->assertSession()->pageTextNotContains('rofl');
}
/**
* Tests the admin translation screen.
*/
public function testAdminTranslation() {
$id = 'water_bear';
$this->createFacet('Water bear', $id);
// Translate the facet.
$this->drupalGet('admin/config/search/facets/' . $id . '/edit/translate/xx-lolspeak/add');
$this->drupalPostForm(NULL, ['translation[config_names][facets.facet.water_bear][name]' => 'Tardigrade'], 'Save translation');
$this->drupalGet('admin/config/search/facets');
$this->assertSession()->pageTextContains('Water bear');
$this->drupalGet('xx-lolspeak/admin/config/search/facets');
$this->assertSession()->pageTextContains('Tardigrade');
}
}
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