Get a contextual filter for a View in Drupal 8 I'm converting a module from D7 to D8 for a client. Some of the code is working programmatically with views - something I haven't done that much in D7, since I just write my own queries.

In the code is this line:

$contextual_filter = method_exists($view, 'get_items') ? $view-&gt;get_items('argument', $display-&gt;id) : 0;


I need to convert this to D8, but I'm not sure entirely what I'm working with here.

What I do know:


In D8, $view is an object of type Drupal\views\ViewExecutable
In D8, there is no get_items() method, nor a getItems() method on ViewExecutable
ViewExecutable has a property, args, and also a property argument


My questions:


How can I get the items from ViewExecutable
How can I get the contextual filter from ViewExecutable
Do I even need to do #1 to get #2?


Further down the code, I can see that $contextual filter is used as follows:

'contextual_filter' =&gt; !empty($contextual_filter) ? 1 : 0


So it would appear I'm just trying to get a boolean indicating whether or not a contextual filter exists.

Can anyone who has worked more with D7 Views more than I give me some insight as to what is happening with this code, and ideally how I can update it to D8? (Though insight as to what is happening in D7 may be enough for me to figure it out in D8).
In D8 the settings of a view are stored in a configuration entity. You can load the entity with View::load() or get it from the view executable directly and then load a display and check the contextual filters (stored in the key arguments of the display options):

$storage = $view-&gt;storage;
$display = &amp;$storage-&gt;getDisplay('default');
$arguments = $display['display_options']['arguments'];

'contextual_filter' =&gt; !empty($arguments) ? 1 : 0