I had a similar question recently, related to changing the path on a Views Display. Following this reasoning (as well as other examples I've seen), I assumed I could follow a similar approach. Unfortunately, that doesn't seem to be the case.
Related question for reference: Change Views Path Programatically
What I currently have:
$view = \Drupal\views\Entity\View::load('custom_view');
$display =& $view->getDisplay('page_1');
$display['display_options']['title'] = 'My Custom Title';
$view->save();
However, this does not seem to alter the title of the Display. I've attempted a method of changing the Display title in a Views hook, at that works correctly, but I'd like to be able to change the title without relying on actually viewing the View to utilize its hooks. In addition, I believe this would set the title for all Displays, which I don't want. Working example:
function my_moudule_views_post_render(ViewExecutable $view) {
$view->setTitle('My Custom Title');
}
Following this approach, I attempted to utilize the \Drupal\views\Views::getView()
method, but was unsuccessful.