|
@@ -45,13 +45,32 @@ class MaterioSapiSearchForm extends FormBase {
|
|
|
"v-model" => "autocomplete"
|
|
|
],
|
|
|
];
|
|
|
- // $form['submit'] = [
|
|
|
- // '#type' => 'submit',
|
|
|
- // '#value' => $this->t('Search'),
|
|
|
- // '#attributes' => [
|
|
|
- // '@click.prevent' => "submit",
|
|
|
- // ]
|
|
|
- // ];
|
|
|
+
|
|
|
+ $form['filters'] = [
|
|
|
+ '#type' => 'container'
|
|
|
+ ];
|
|
|
+
|
|
|
+ $query = \Drupal::entityQuery('taxonomy_term');
|
|
|
+ $query->condition('vid', "assisted_research");
|
|
|
+ $tids = $query->execute();
|
|
|
+ $terms = \Drupal\taxonomy\Entity\Term::loadMultiple($tids);
|
|
|
+
|
|
|
+ foreach ($terms as $tid => $term) {
|
|
|
+ $childs = $term->get('field_terms')->getValue();
|
|
|
+ $options = array($term->getName());
|
|
|
+ foreach ($childs as $child) {
|
|
|
+ $child_term = \Drupal\taxonomy\Entity\Term::load($child['target_id']);
|
|
|
+ $options[$child_term->id()] = $child_term->getName();
|
|
|
+ }
|
|
|
+ $form['filters']['filter-'.$tid] = array(
|
|
|
+ '#type' => 'select',
|
|
|
+ // '#title' => $term->getName(),
|
|
|
+ // '#multiple' => true,
|
|
|
+ '#options' => $options
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
$form['submit'] = array(
|
|
|
'#type' => 'button',
|
|
|
// '#src' => '',//drupal_get_path('module', 'materio_search_api') . '/images/search.png',
|