How to use hook 'printFieldListWhere'

I want to inject a limitation to the sql statement on product/list.php by extending the WHERE part.

Now I can use the hook ‘printFieldListWhere’ but since my module also hooks into the context = main.
I do not see how to filter in the action function printFieldListWhere() when to inject and when not. $parameters is not set with anything distinctive in the list.php. Is this a “bug”?

I have a partial solution

I do

if ( in_array('productservicelist', $hookmanager->contextarray) ) {}

to limit the impact to product/list.php but it breaks the query for categories and bookmarks.

I suspect that the hooks needs to get data into $parameters in the core file. Otherwise I do not see how to filter this further

public function printFieldListWhere($parameters, &$object, &$action, $hookmanager)
{
	global $conf, $user, $langs;
		
	$error = 0; // Error counter
		
	if (in_array('productservicelist', explode(':', $parameters['context']))) {
	
		// YOUR CODE HERE
		
	}

	if (!$error) {
		return 0; // or return 1 to replace standard code
	} else {
		$this->errors[] = 'Error message';
		return -1;
	}
}

The above code must be in a file called “actions_yourmodulename.class.php” inside “class” folder in your module.

You can use the Module builder to create this file and then ammend it as needed.