I installed the flag list operations module which gives me the ability to do operations on my views results. But this flag list operations doesn't show up on my search index view as seen below.

I'm sure there is some parameter or variable that is set in the flag list module that is preventing this operation to show up on the search index view.

What should I be looking for in the flag list module code to enable this operation to show up in the search index view?

enter image description here

enter image description here


Those flag list operations come from a Views handler; they're applied only to the node entity type in flag_lists_views_data_alter.

The Indexed node isn't a node entity, it's something specific to the search API module (added in search_api_views_views_data). It only contains fields that are indexed, plus any extra stuff search API or contrib modules add on.

I haven't tried it, but you may be able to include the nid in the index, and add a relationship in the View to Content. That would, in theory, give you access to everything that Views knows about for a node.

Failing that, you'll probably have to implement your own Views handler, implement hook_views_data_alter, and find the table whose field handler you need to override (it'll be search_api_index_MACHINE_NAME). The class in includes/flag_lists_handler_field_ops.inc would probably be a good template to start from.

  • thanks clive, im totally stuck for the past 2 days. see: prntscr.com/i5nmoi i added a new array to the existing $data array and pointed it to a new handler --- but it still doesn't show up on the "search index" view. I tried to look at the views_bulk_operations.views.inc and see how they did it as that "operation" shows up on the search index view. I'm totally lost on where you find this "table" you speak of. The extended class that is used in flag_lists is views_handler_field but views_bulk_operations uses the class views_handler_field_entity ... – Patoshi パトシ Jan 25 '18 at 22:55

Took me a good 20-30+ hours to figure this one out as this involved knowing how Views Handlers work and reverse engineering the flag list module code.

In the case of the flag_list module not working with the search api index, it had to do with creating a new handler. The flag list operations handler was extending the class views_handler_field but you needed views_handler_field_entity for the search api view to see it. I'm not sure why, but I followed the views_bulk_operations module as an example.

From there I copied all the code from the original flag list operations handler code into my new handler that uses the views_handler_field_entity with some modifications in the code that had to do with targeting the nid as the $data array was different from the $data array in the views_handler_field.

Then, to get the flag list operations form to show up, I had to find the form_alter in the flag_lists.module file and have it recognize the new handler I had.

In total I had to modify:

  • flag_lists.module
  • flag_lists.views.module
  • flag_lists_handler_field_ops_xxx.inc (this is my new handler file called xxx)

enter image description here

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.