Get the list of all display IDs of a view

Hello All,

I’m doing some custom development involving the Views Class (https://api.drupal.org/api/drupal/core%21modules%21views%21src%21Entity%21View.php/class/View/8.5.x) for a small project.

I’ve created a view programmatically, and it has a couple of displays, besides “default”: block_1 and page_1. It could have more displays in the future, it depends of the user’s requirements.

Is there any way to get the list of display IDs or titles programmatically? I know that this class has the methodView::getDisplay but it takes the ID of the Display, which I couldn’t know at this point.

This class also has the protected property View::$display, which stores all display handlers of this view. But it is a protected property, so I won’t be able to use it from my code.

Thanks in advance

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed