How to create a custom handler in view? I am trying to alter a field's argument handler. But It is showing me broken/missing handler in view's argument. I have tried it in following ways :

I am adding the following two code block in hook_field_views_data_alter where :

$table_name = node__field_test;
$field_col = field_test_value;


I want to change handler for a field.

First method by reviewing time spent module's code :

$data[$table_name][$field_col]['argument']['id'] = 'MyClassName';


I didn't understand the concept of id above and how it will recognise the class of my module?

Second method as in D7 :

$data[$table_name][$field_col]['argument']['handler'] = 'MyClassName'; // Second


How It works in D8?
The id is a plugin ID. You either need to define your own views argument plugin and change the id to that or alter the plugin definition and replace the class there.

The first will just update a specific field, the second would replace the plugin everywhere where it is used.