Maybe because of the naming convention, with grav referring to pages and page as variables, it also worth staying clear of them as variable names just in case.
Old school programming
$page = ...
and go for
$mypage =
to keep things clear.
I am not the best on oops and getting my hands really dirty with the api
https://learn.getgrav.org/17/api
[s]but grav::instance seems to be deprecated and refers with a parameter for languages alot of the api refers to getInstance() instead.[/s]
This is sample of code from grav latest core
/**
* Return the Grav instance. Create it if it's not already instanced
*
* @param array $values
* @return Grav
*/
public static function instance(array $values = [])
{
if (null === self::$instance) {
self::$instance = static::load($values);
} elseif ($values) {
$instance = self::$instance;
foreach ($values as $key => $value) {
$instance->offsetSet($key, $value);
}
}
return self::$instance;
}
I presume your blueprint is basically trying to display a list a of pages / all pages
It seems standard practice to check the parameter for existing data and then create the instance.
It is a big hard knowing only a snap shot of what your trying to do, but people like @pamtbaau will probably able to advise further , on best practises but I am sure he will require a bit more info (blueprint, function code etc, aim of functionality to be achieved)