4 users online. Create an account or sign in to join them.Users
Extension Driver: Fetching the Page Root?
This is an open discussion with 2 replies, filed under Extensions.
Search
I had the same problem — $context in this instance is an object with mostly private members which cannot be accessed.
You can however inspect the type of Administration::instance()->Page like so:
if (Administration::instance()->Page instanceof contentBlueprintsSections) {
var_dump(Administration::instance()->Page->_context);
}
The use of the static Administration instance (and Frontend instance for front end pages) means the $context is mostly redundant in this instance. Of course, context elsewhere receives things such as arrays and IDs which can’t be gleaned from the parent instance.
Nick, that’s a great tip - thank you!
Create an account or sign in to comment.
I’m building an extension and I’m trying to do a quite simple thing: I’d like to insert a script to the backend pages when the user browses
/blueprints/sections/.I know how to always append the script:
public function getSubscribedDelegates(){ return array( array( 'page' => '/administration/', 'delegate' => 'AdminPagePreGenerate', 'callback' => '__appendAssets' ) ); } public function __appendAssets($context) { Administration::instance()->Page->addScriptToHead(URL . '/extensions/mediathek/assets/section.js', 100); }But how do I add a check for the currently browsed backend page? If I simple print
$contextI find something calledpagerootwhich contains everything I need, but I don’t know how to access it.Any tips or ideas?