Commit 86c27cd6 authored by Daniel Ehrenhofer's avatar Daniel Ehrenhofer Committed by Markus Kalkbrenner
Browse files

Issue #3255454: Checkbox and Links searchbox widget extension

parent 40035c03
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
facet.widget.config.searchbox_checkbox:
  type: facet.widget.config.checkbox
facet.widget.config.searchbox_links:
  type: facet.widget.config.links
+17 −0
Original line number Diff line number Diff line
.facets-widget-searchbox_checkbox .facets-widget-searchbox {
  margin-bottom: 1rem;
}

.facets-widget-searchbox_links .facets-widget-searchbox {
  margin-bottom: 1rem;
}

.facets-widget-searchbox_links .facet-item--expanded .facets-widget-searchbox,
.facets-widget-searchbox_links .facet-item--expanded .facets-widget-searchbox-no-result {
  display: none;
}

.facets-widget-searchbox-no-result.hide,
.hide-if-no-result.hide {
  display: none;
}
+11 −0
Original line number Diff line number Diff line
name: 'Facets Searchbox Widget'
type: module
description: 'Provides a input to search and filter facet items.'
core_version_requirement: ^9.1
package: Search
dependencies:
  - facets:facets
test_dependencies:
  - search_api:search_api
  - facets:facets
  - drupal:views
+11 −0
Original line number Diff line number Diff line
searchbox:
  version: VERSION
  js:
    js/searchbox.js: { attributes: { defer: true } }
  css:
    component:
      css/searchbox.css: {}
  dependencies:
    - core/drupal
    - core/drupalSettings
    - core/jquery.once
+84 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Contains install hooks for facets searchbox widget.
 */

/**
 * Implements hook_theme().
 */
function facets_searchbox_widget_theme($existing, $type, $theme, $path) {
  return [
    'facets_item_list__searchbox_checkbox' => [
      'variables' => [
        'facet' => NULL,
        'items' => [],
        'title' => '',
        'list_type' => 'ul',
        'wrapper_attributes' => [],
        'attributes' => [],
        'empty' => NULL,
        'context' => [],
      ],
    ],
    'facets_item_list__searchbox_links' => [
      'variables' => [
        'facet' => NULL,
        'items' => [],
        'title' => '',
        'list_type' => 'ul',
        'wrapper_attributes' => [],
        'attributes' => [],
        'empty' => NULL,
        'context' => [],
      ],
    ],
  ];
}

/**
 * Prepares variables for facets summary item list templates.
 *
 * Default template: facets--item-list.html.twig.
 *
 * @param array $variables
 *   An associative array containing:
 *   - items: An array of items to be displayed in the list. Each item can be
 *     either a string or a render array. If #type, #theme, or #markup
 *     properties are not specified for child render arrays, they will be
 *     inherited from the parent list, allowing callers to specify larger
 *     nested lists without having to explicitly specify and repeat the
 *     render properties for all nested child lists.
 *   - title: A title to be prepended to the list.
 *   - list_type: The type of list to return (e.g. "ul", "ol").
 *   - wrapper_attributes: HTML attributes to be applied to the list wrapper.
 *
 * @see https://www.drupal.org/node/1842756
 */
function facets_searchbox_widget_preprocess_facets_item_list__searchbox_checkbox(array &$variables) {
  template_preprocess_item_list($variables);
}

/**
 * Prepares variables for facets summary item list templates.
 *
 * Default template: facets--item-list.html.twig.
 *
 * @param array $variables
 *   An associative array containing:
 *   - items: An array of items to be displayed in the list. Each item can be
 *     either a string or a render array. If #type, #theme, or #markup
 *     properties are not specified for child render arrays, they will be
 *     inherited from the parent list, allowing callers to specify larger
 *     nested lists without having to explicitly specify and repeat the
 *     render properties for all nested child lists.
 *   - title: A title to be prepended to the list.
 *   - list_type: The type of list to return (e.g. "ul", "ol").
 *   - wrapper_attributes: HTML attributes to be applied to the list wrapper.
 *
 * @see https://www.drupal.org/node/1842756
 */
function facets_searchbox_widget_preprocess_facets_item_list__searchbox_links(array &$variables) {
  template_preprocess_item_list($variables);
}
Loading