Skip to content
Snippets Groups Projects

ISTWCMS-6944: add uuid to the catalog search form

Merged Eric Bremner requested to merge feature/ISTWCMS-6944-ebremner-fix-search-block-labels into 1.0.x
@@ -122,11 +122,24 @@ class CatalogSearchForm extends FormBase {
* A flag to use a placeholder.
* @param string $placeholder
* The placeholder string.
* @param string $uuid
* The unique identifier.
*
* @return array
* The form structure.
*/
public function buildForm(array $form, FormStateInterface $form_state, int $tid = NULL, string $description = NULL, bool $use_placeholder = TRUE, string $placeholder = NULL): array {
public function buildForm(
array $form,
FormStateInterface $form_state,
int $tid = NULL,
string $description = NULL,
bool $use_placeholder = TRUE,
string $placeholder = NULL,
string $uuid = NULL
): array {
// Add the unique id.
$form['#attributes']['id'] = 'uw-catalog-form-' . $uuid;
// Get the current route.
$route = $this->routeMatch->getRouteName();
@@ -229,6 +242,9 @@ class CatalogSearchForm extends FormBase {
'#required' => TRUE,
];
// Set the id with the uuid.
$form['search_input']['#attributes']['id'] = 'edit-search-input-' . $uuid;
// Add a submit button that handles the submission of the form.
$form['submit'] = [
'#type' => 'submit',
Loading