Skip to content
Snippets Groups Projects
Commit 4f5f5f36 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5129: updating tabs for services

parent d6b66f9e
No related branches found
No related tags found
4 merge requests!60ISTWCMS-6095 Update maxlength settings for title, text fields and link fields...,!25ISTWCMS-5779 Click update button under...,!8Feature/istwcms 5127 ebremner services blocks gui,!7Feature/istwcms 5129 ebremner theme services views
......@@ -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.');
}
}
}
......
......@@ -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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment