In views_autocomplete_filters.inc

if (empty($matches)) {
    $matches[''] = '<div class="reference-autocomplete">' . t('The %string return no results. Please try something else.', array('%string' => $string)) . '</div>';
  }

I want to customize the message based on role. I assume I need to hack into the module right? (i.e. There is no proper way to do it)

Comments

glynster’s picture

I second having this ability. Even if we were able to have the option inside the views autocomplete options to set the no result message would be a huge help. Having this hard coded into the module gives no flexibility. Adding per role I would think is quite a small user case. But I do second being able to customize through views.

rjacobs’s picture

Title: Customize empty result message » Customize empty result message programmatically
Category: Support request » Feature request
Issue summary: View changes

For static (non-conditional) changes to that text, please note that you can target the string "The %string return no results. Please try something else." with a tool like string overrides or with a variable alteration (e.g. addition to locale_custom_strings_en variable).

This of course does not help for programmatic/conditional changes. What concerns me is that there currently appears to be no way make such alterations as there are no hooks or templates available that allow alteration of the returned json that populates the suggestions.

This is starting to sound like a feature request.

rjacobs’s picture

I'm proposing the addition of a hook which may help with this need. See: #2337677: DX request: add hook to allow programmatic alteration of returned matches.

I've opened that as a separate issue as alterations via a hook may not be the right kind of solution for this problem for everyone. I assume this one can remain for anyone interested in related feature addition that deals with this via a GUI.

vasike’s picture

Status: Active » Closed (duplicate)

i close this, as i think, the same as @rjacobs it will be covered by #2337677: DX request: add hook to allow programmatic alteration of returned matches