Skip to content
Snippets Groups Projects
Commit 1ab515f5 authored by Sam Lerner's avatar Sam Lerner Committed by Timothy Zura
Browse files

Issue #3365089 by SamLerner: Add option for aria labels on the form elements

parent 4b538ecd
No related branches found
No related tags found
1 merge request!7Adds arial-label options to keyword and submit button form elements.
......@@ -434,6 +434,10 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
$form['keys']['#attributes']['class'][] = $this->configuration['classsearchkeys'];
}
if (!empty($this->configuration['searchinputarialabel'])) {
$form['keys']['#attributes']['aria-label'] = $this->configuration['searchinputarialabel'];
}
// Programmable search page select element.
if ($this->configuration['displaysearchpageselection']) {
$searchpageoptions = [];
......@@ -485,7 +489,6 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
if (!empty($this->configuration['classsearchsort'])) {
$form['sort']['#attributes']['class'][] = $this->configuration['classsearchsort'];
}
}
// Search submit element.
......@@ -498,6 +501,10 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
$form['submit']['#attributes']['class'][] = $this->configuration['classsearchsubmit'];
}
if (!empty($this->configuration['searchsubmitarialabel'])) {
$form['submit']['#attributes']['aria-label'] = $this->configuration['searchsubmitarialabel'];
}
}
/**
......@@ -574,7 +581,7 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
];
$form['google_serp_options']['resultsperpage'] = [
'#title' => $this->t('Number of results per page?'),
'#title' => $this->t('Number of results per page'),
'#type' => 'select',
'#options' => [
10 => 10,
......@@ -584,28 +591,38 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
50 => 50,
],
'#default_value' => $this->configuration['resultsperpage'] ?? '',
'#description' => $this->t('How many results should appear on each search page?'),
];
$form['google_serp_options']['removedomain'] = [
'#title' => $this->t('Remove Domain from Result Link URLs?'),
'#title' => $this->t('Remove Domain from Result Link URLs'),
'#type' => 'checkbox',
'#default_value' => $this->configuration['removedomain'] ?? '',
'#description' => $this->t('Removing the domain makes all search results relative links, instead of pointing to the production domain. Useful when working with non-production domains.'),
];
$form['google_serp_options']['displaysearchform'] = [
'#title' => $this->t('Display Search Form on SERP?'),
'#title' => $this->t('Display Search Form on results page'),
'#type' => 'checkbox',
'#default_value' => $this->configuration['displaysearchform'] ?? '',
'#description' => $this->t('Allow search box to appear on the SERP.'),
];
$form['google_serp_options']['classsearchkeys'] = [
'#title' => $this->t('Search Keywords Input Class'),
'#title' => $this->t('Keywords Input Class'),
'#type' => 'textfield',
'#default_value' => $this->configuration['classsearchkeys'] ?? '',
'#description' => $this->t('Add optional class to the search keys input element.'),
'#description' => $this->t('Add optional class to the keywords input element.'),
'#states' => [
'visible' => [
':input[name="displaysearchform"]' => ['checked' => TRUE],
],
],
];
$form['google_serp_options']['searchinputarialabel'] = [
'#title' => $this->t('Keywords Input Aria Label'),
'#type' => 'textfield',
'#default_value' => $this->configuration['searchinputarialabel'] ?? '',
'#description' => $this->t('Add optional aria-label attribute the keywords input element.'),
'#states' => [
'visible' => [
':input[name="displaysearchform"]' => ['checked' => TRUE],
......@@ -614,23 +631,34 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
];
$form['google_serp_options']['classsearchsubmit'] = [
'#title' => $this->t('Search Submit Input Class'),
'#title' => $this->t('Submit Input Class'),
'#type' => 'textfield',
'#default_value' => $this->configuration['classsearchsubmit'] ?? '',
'#description' => $this->t('Add optional class to the search submit input element.'),
'#description' => $this->t('Add optional class to the submit input element.'),
'#states' => [
'visible' => [
':input[name="displaysearchform"]' => ['checked' => TRUE],
],
],
];
$form['google_serp_options']['searchsubmitarialabel'] = [
'#title' => $this->t('Submit Input Aria Label'),
'#type' => 'textfield',
'#default_value' => $this->configuration['searchsubmitarialabel'] ?? '',
'#description' => $this->t('Add optional aria-label attribute the submit input element.'),
'#states' => [
'visible' => [
':input[name="displaysearchform"]' => ['checked' => TRUE],
],
],
];
$form['google_serp_options']['displaysearchpageselection'] = [
'#title' => $this->t('Display search page selection on SERP?'),
'#title' => $this->t('Display search page selection on results page'),
'#type' => 'checkbox',
'#default_value' => $this->configuration['displaysearchpageselection'] ?? '',
'#description' => $this->t('Allow selection of other search pages from search box on SERP.'),
'#description' => $this->t('Allow selection of other search pages from search box on results page.'),
'#states' => [
'visible' => [
':input[name="displaysearchform"]' => ['checked' => TRUE],
......@@ -651,10 +679,9 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
];
$form['google_serp_options']['displaysort'] = [
'#title' => $this->t('Display Sort Options on SERP?'),
'#title' => $this->t('Display Sort Options on results page'),
'#type' => 'checkbox',
'#default_value' => $this->configuration['displaysort'] ?? '',
'#description' => $this->t('Allow sort options to appear on SERP.'),
'#states' => [
'visible' => [
':input[name="displaysearchform"]' => ['checked' => TRUE],
......@@ -663,7 +690,7 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
];
$form['google_serp_options']['classsearchsort'] = [
'#title' => $this->t('Search Sort Select Class'),
'#title' => $this->t('Sort Select Class'),
'#type' => 'textfield',
'#default_value' => $this->configuration['classsearchsort'] ?? '',
'#description' => $this->t('Add optional class to the search sort select element.'),
......@@ -758,7 +785,9 @@ class GoogleJsonApiSearch extends ConfigurableSearchPluginBase {
$this->configuration['results_last_page_message'] = $values['results_last_page_message'];
$this->configuration['classsearchkeys'] = $values['classsearchkeys'];
$this->configuration['classsearchsubmit'] = $values['classsearchsubmit'];
$this->configuration['searchinputarialabel'] = $values['searchinputarialabel'];
$this->configuration['classsearchpageselect'] = $values['classsearchpageselect'];
$this->configuration['searchsubmitarialabel'] = $values['searchsubmitarialabel'];
$this->configuration['classsearchsort'] = $values['classsearchsort'];
$this->configuration['removedomain'] = $values['removedomain'];
......
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