i have a set of pages with similar blueprints: message.yml, message-a.yml, message-b.yml.
In a hook page.changeStatus:after i have to make decicions depending the exact type of the blueprint. so i thought $page->blueprint()->name() should do the job:
surprisingly that gives me the complete path, but not the (file-)name:
$page->blueprint()->name(); //'pages/message' or 'pages/message-a'
My current solution is to explode that path to an array and use the last item as the identifier,
but that seems a bit hackish to me and i am actually not sure it that will work on windows-machines too.
$array = explode("/", $page->blueprint()->name());
$name = end($array);
$page->intendedTemplate() does not work, because all pages/blueprints are using the same template by the ‘shared-templates’ plugin feature… $page->blueprint()->title() for some reasons is also not my favorite.
so, is there a better way to identify the blueprint of a page, rather than exploding the path and use the last item?
thx.