Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
google_json_api
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
google_json_api
Commits
1ab515f5
Commit
1ab515f5
authored
1 year ago
by
Sam Lerner
Committed by
Timothy Zura
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3365089
by SamLerner: Add option for aria labels on the form elements
parent
4b538ecd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Adds arial-label options to keyword and submit button form elements.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/Search/GoogleJsonApiSearch.php
+44
-15
44 additions, 15 deletions
src/Plugin/Search/GoogleJsonApiSearch.php
with
44 additions
and
15 deletions
src/Plugin/Search/GoogleJsonApiSearch.php
+
44
−
15
View file @
1ab515f5
...
...
@@ -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'
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment