Update the settings of a View Display programmatically
Answering my own question:
The settings are not made on the display, but on the handler.

$view = Views::getView('existing_view');
$display = $view-&gt;newDisplay('page', 'New page', 'page_2');

// ViewExecutable::setHandlerOption($display_id, $type, $id, $option, $value)
$view-&gt;setHandlerOption('page_2', 'argument', 'nid', 'admin_label', 'Foo');
$view-&gt;save();


Options and values correspond to the values in a View YAML config file, under display_options.

Important is that you find out the correct $type argument.

I had a look at the array keys returned from ViewExecutable::getHandlers.


"field"
"argument"
"sort"
"filter"
"relationship"
"header"
"footer"
"empty"