Panel equivalent for 'isActive'

I have a custom page-model backed by a huge database where I want to control the content fetched from the database depending on what page/panel-page is requested.

For example, the parent page creates a list of all its children (which can range from a few 100 to a few 1000). Normally it’s content is not loaded unless required. If a panel-page tries to display a list of all its children (bleuprints Pages section). It will load all the content while it only needs their title (and creation date in my case).

I noticed a ‘isActive’ function in the model, which works great for if the requested page (front-end) is the current model-page. But it seems to run false when this is the case for a panel-view (back-end) of the same page.

So the question is, how to detect if the content of a Page is requested as a panel-view rather than a preview for its parent ‘Pages section’?

I found a shady solution for this. I use this in a model class, so $this refers to a Page instance.

$isPanelActive = R::instance()->path()->toString() == 'api'. $this->panelURL(true);
  1. If there is a posibility to change the api url, this would propably break
  2. This is not mutli-language friendly.

So any input on these 2 points is appreciated to create the ‘perfect’ isPanelActive function