- Issue created by @khiminrm
- πΊπ¦Ukraine khiminrm
Attaching a quick patch which helped me to fix the issue when using the facets_form_checkbox widget.
- πΊπ¦Ukraine khiminrm
btw, the code which builds the container with the empty text can be found in Drupal\facets\FacetManager\DefaultFacetManager::build() under the comment
// No results behavior handling. Return a custom text or false depending on // settings.
- πΊπ¦Ukraine khiminrm
Maybe this should be on the widget plugin base e.g. add it's own custom config similar to the Facet's config. And use it instead there.
- πΊπ¦Ukraine khiminrm
I've created custom CheckboxesWidget plugin and used such code:
if (!empty($this->processedItems)) { $content = [ '#type' => 'checkboxes', '#options' => $options, '#default_value' => $default_value, '#after_build' => [[static::class, 'indentCheckboxes']], '#depths' => $depths, '#ancestors' => $ancestors, '#indent_class' => $this->getConfiguration()['indent_class'], ]; } else { $content = [ '#type' => 'container', '#attributes' => [ 'data-drupal-facet-id' => $facet->id(), 'class' => ['facet-empty'], ], 'empty_text' => [ '#markup' => $this->t('No applicable options available.'), ], ]; } return [ $facet->id() => [ '#type' => 'fieldset', '#title' => $facet->getName(), '#attributes' => [ 'data-drupal-facets-form-ancestors' => Json::encode($ancestors), ], $facet->id() => $content, ], ];