Skip to content

Commit

Permalink
Merge pull request #475 from esmero/ISSUE-474
Browse files Browse the repository at this point in the history
ISSUE-474: BEF Advanced Search & Modal Exposed Form Block improvements
  • Loading branch information
DiegoPino authored Oct 17, 2024
2 parents 6ecce09 + 17517ec commit 4d2c7d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ public function getCacheContexts() {
*/
public function build()
{
$add_classes = function (array &$option, $classes_to_add) {
$classes = preg_split('/\s+/', $classes_to_add);
$classes = array_filter($classes);
$option = array_unique(array_merge($option, $classes));
};

$is_sort_exposed = FALSE;

/** @var \Drupal\views\Plugin\views\HandlerBase $sort */
$sort_ids = [];
foreach ($this->view->display_handler->getHandlers('sort') as $key => $sort) {
Expand Down Expand Up @@ -219,6 +223,14 @@ public function build()
}

if (is_array($output) && !empty($output)) {
$classes = $output['#attributes']['class'] ?? [];
if ($this->view->display_handler->options['defaults']['css_class']) {
$add_classes( $classes, $this->view->displayHandlers->get('default')->options['css_class']);
}
else {
$add_classes($classes, $this->view->display_handler->options['css_class'] );
}
$output['#attributes']['class'] = $classes;
$output += [
'#view' => $this->view,
'#display_id' => $this->displayID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ public function buildExposedForm(&$form, FormStateInterface $form_state) {
}
if ($i >= $this->options['expose']['advanced_search_fields_count_min'] && $multiple_delone) {
// Only add a minus for counts larger than the minimum.
$single_delete_one['#group'] = $this->options['id'] . '_wrapper_' . $i;
$form[$this->options['id'] . '_wrapper_' . $i][$this->options['id'] . '_delone_' . $i] = $single_delete_one;
}
$form[$this->options['id'].'_wrapper_'.$i]['#title_display'] = 'invisible';
Expand Down

0 comments on commit 4d2c7d3

Please sign in to comment.