Alter Entity Reference View Widget available options I have 2 content types business, locations, programs and services.

At program level we select all the services associated with that program.

At business level we select the programs the business is associated with.

At the location level based on the programs selected we give the option to sub select the services.

Now the services entity reference is displayed via Entity Reference View Widget. All I want to do is alter or unset certain options based on the choices made at the business level in terms of program selection.

I tried working at the views level to pass it as an argument but was unsuccessful. Then tried the node form alter but the unset option still shows up but without the checkbox.
 

Tried to alter it using hook_field_widget_form_alter as well but was not successful. 

It looks like it implements a preprocess function entityreference_view_widget_preprocess_widget but I am not able to override it.

Looking for pointers if anyone has come across similar problem.
Ending up using hook_views_pre_render(&amp;$view). So I did something like this

function contractor_programs_views_pre_render(&amp;$view) {
  if ($view-&gt;name == 'location_services' &amp;&amp; $view-&gt;current_display == 'entityreference_view_widget_1') {
    // added my logic to get the service options
    if (!empty($services_options)) {
        $services_options = array_keys($services_options);
        if (!empty($view-&gt;result)) {
          foreach($view-&gt;result as $key =&gt; $value) {
            if (!in_array($value-&gt;nid, $services_options)) {
              unset($view-&gt;result[$key]);
            }
          }
        }
      }
  }
}