0

How I can ignore special characters from expose filter.for example: I have a view with expose filter ( Title ) but if I write the text without special characters it returns ( No Result ) & if write the text with those special characters I have resulted.

Note: When I created the node I wrote the Title with special characters

Example: I created a node with Title (i'ts) if I searched in expose filter by using (its) it returns(No Result) but if I wrote (i'ts) it works fine

0

in hook_form_alter function you can check the expose form and write your below function.

function clean($string) { $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.

return preg_replace('/[^A-Za-z0-9-]/', '', $string); // Removes special chars. }

assign value to form value array.

|improve this answer|||||
  • unfortunately did not work, do you have another way to solve this problem? – Mohammed Saeed Sep 30 '18 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.