diff --git a/src/Form/ServiceSearchForm.php b/src/Form/ServiceSearchForm.php index 11f5d607fa7c13c80ea5528cbee954105cce5885..ede185b5b99301a75fc3af9717954834b14109ae 100644 --- a/src/Form/ServiceSearchForm.php +++ b/src/Form/ServiceSearchForm.php @@ -210,11 +210,6 @@ class ServiceSearchForm extends FormBase { // in the form submit. $form_state->set('tid', $url[3]); } - else { - - // Throw a Drupal error that there was no service to search. - $this->messenger->addError('There is no specific service to be searched.'); - } } } diff --git a/uw_ct_service.module b/uw_ct_service.module index a9cedbafe7ef0579f4d84e1c572518a4798835f0..0a5681950ecf83fced9f13462976202ca62adca5 100644 --- a/uw_ct_service.module +++ b/uw_ct_service.module @@ -143,6 +143,8 @@ function uw_ct_service_preprocess_views_view(&$variables) // Putting the service search form into // variables so that views template can use it. if (in_array($id, $services_ids)) { + + // Put the form into the variables. $variables['form_search'] = \Drupal::formBuilder()->getForm('Drupal\uw_ct_service\Form\ServiceSearchForm'); // Get the current path and put into array based on @@ -150,31 +152,38 @@ function uw_ct_service_preprocess_views_view(&$variables) $current_path = \Drupal::service('path.current')->getPath(); $current_path_parts = explode('/', $current_path); + // If we have something past /services add the tabs. if (isset($current_path_parts[2])) { + + // Tab for Category. $content_list[] = [ 'url' => '/taxonomy/term/' . end($current_path_parts), 'text' => 'Category', 'active' => strpos($current_path, '/taxonomy/term/') !== false ? 1 : 0, ]; + // Tab for A-Z. $content_list[] = [ 'url' => '/services/all', 'text' => 'A-Z', 'active' => $current_path == '/services/all' ? 1 : 0, ]; + // Tab for Audience. $content_list[] = [ 'url' => '/services/audience', 'text' => 'Audience', 'active' => strpos($current_path, '/services/audience/') !== false ? 1 : 0, ]; + // Tab for Popular. $content_list[] = [ 'url' => '/services/popular', - 'text' => 'Audience', + 'text' => 'Popular', 'active' => strpos($current_path, '/services/audience/') !== false ? 1 : 0, ]; + // Set the tabs in the variables. $variables['content_list'] = $content_list; } }