toggle search filers display
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Solarium\QueryType\Select\Query\Query;
|
||||
use Drupal\search_api\Query\QueryInterface;
|
||||
use Drupal\Core\Template\Attribute;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
@@ -48,3 +50,20 @@ function materio_sapi_search_api_solr_query_alter(Query $solarium_query, QueryI
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares variables for fieldset element templates.
|
||||
*
|
||||
* Default template: fieldset.html.twig.
|
||||
*
|
||||
* @param array $variables
|
||||
* An associative array containing:
|
||||
* - element: An associative array containing the properties of the element.
|
||||
* Properties used: #attributes, #children, #description, #id, #title,
|
||||
* #value.
|
||||
*/
|
||||
function materio_sapi_preprocess_fieldset(&$variables) {
|
||||
if (isset($variables['element']['#legend_attributes'])) {
|
||||
$variables['legend']['attributes'] = new Attribute($variables['element']['#legend_attributes']);
|
||||
}
|
||||
}
|
||||
|
@@ -47,9 +47,18 @@ class MaterioSapiSearchForm extends FormBase {
|
||||
];
|
||||
|
||||
$form['filters'] = [
|
||||
'#type' => 'container'
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Assisted Search'),
|
||||
'#legend_attributes' => [
|
||||
"class" => ["test-attribute"],
|
||||
'@click.prevent' => "onClickFilters",
|
||||
]
|
||||
];
|
||||
|
||||
// $form['filters']['switch'] = [
|
||||
// '#type' => "label",
|
||||
//
|
||||
// ]
|
||||
$query = \Drupal::entityQuery('taxonomy_term');
|
||||
$query->condition('vid', "assisted_research");
|
||||
$tids = $query->execute();
|
||||
|
Reference in New Issue
Block a user