Commit 4ab79028 authored by borisson_'s avatar borisson_ Committed by borisson_
Browse files

Issue #2835091 by borisson_: Facet summary - wrong default enabled facets

parent b2c4b7a4
......@@ -401,11 +401,15 @@ class FacetsSummaryForm extends EntityForm {
// Set our Facet Config.
$facets_summary->setFacets((array) $form_state->getValue(['facets']));
$value = $form_state->getValue('facets') ?: [];
$enabled_facets = array_filter($value, function ($item) {
return isset($item['checked']) && $item['checked'] == 1;
$facets_summary->setFacets((array) $enabled_facets);
drupal_set_message(t('Facets Summary %name has been updated.', ['%name' => $facets_summary->getName()]));
drupal_set_message($this->t('Facets Summary %name has been updated.', ['%name' => $facets_summary->getName()]));
......@@ -90,9 +90,20 @@ class IntegrationTest extends FacetsTestBase {
// Go back to the facet summary and check that the facets are not checked by
// default and that they show up in the list here.
$this->assertNoText('No facets found.');
// Post the form and check that no facets are checked after saving the form.
$this->drupalPostForm(NULL, [], 'Save');
// Enable a facet and check it's status after saving.
$this->drupalPostForm(NULL, ['facets[llama][checked]' => TRUE], 'Save');
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