I have multilingual site and has a lot of facets blocks, for example this four.

facets

Their labels is translated:

Translation

But on admin page they prints original value. Maybe this is similar bug, but blocks for this facets also has original value as label:

blocks

They are also translated and correctly printed on the page, but admin UI has incorrect values.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Niklan created an issue. See original summary.

Niklan’s picture

Issue summary: View changes
borisson_’s picture

Not sure if this related to facets specifically or to core's block system. This looks like it's the latter. Do you have the same problems with other blocks (a custom block or something like that?)

The positioning of the blocks is not something we control ourselves but we let core handle that.

Niklan’s picture

Hm, I will try it in few hours. Thank you for answer.

Niklan’s picture

I fixed it. Was my mistake. All the blocks in this sidebar has 0 wight. At first I looking for this, but by mistake I look at first sidebar weight, not the second, which is normal. I reorder them and they showed in the same order on all languages!

Thank you!

By the way, the labels for facets which is not shown correct translation is bug?

label

This facets labels is translated and on English still shows Russian labels. This is not problem, but maybe a little bug or again my mistake.

borisson_’s picture

Awesome, good to know that we didn't screw with core too much ;)

Yeah, the labels not showing up does sound like a bug. Let's rework this issue summary/title to say that that's what this is about now.

Niklan’s picture

Okay, I rework issue right now.

Niklan’s picture

Title: The block sorting is alphabetical » Facets label in administrative interface shows original value
Component: Code » User interface
Category: Support request » Bug report
Issue summary: View changes
FileSize
24.97 KB

Rework issue to another bug.

Niklan’s picture

I created patch to fix this.

  1. Load configurations for facet.
    --- a/src/FacetListBuilder.php
    +++ b/src/FacetListBuilder.php
    @@ -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' => [
    
  2. Get label from config, not from entity.
    @@ -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'],
borisson_’s picture

Status: Active » Needs review

Setting to needs review to see if the testbot likes this, but I think it should.

Status: Needs review » Needs work
borisson_’s picture

Status: Needs work » Needs review
borisson_’s picture

The last submitted patch, 13: facets_label_in-2920766-13--testonly.patch, failed testing. View results

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Going to commit this later today.

  • borisson_ committed 33826d8 on 8.x-1.x
    Issue #2920766 by borisson_, Niklan: Facets label in administrative...
borisson_’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

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