VirtualPage gives you a unique URL to the page where you can add objects.
VirtualPage is intelligent enough to act differently depending on where you
add it.
This way you can create popup on page load.
$vp = $this->add('VirtualPage');
$this->js(true)->univ()->frameURL('MyPopup',$vp->getURL());
$vp->set(function($vp){
$vp->add('LoremIpsum'); // <-- will appear within a frame
});
Here is how you can bind it to a button or other view through JS element.
Calling "bindEvent" will automatically tie in frameURL for you.
$b=$page->add('Button')->set('Open popup');
$b->add('VirtualPage')
->bindEvent('My Cool Title','click')
->set(function($page){
$page->add('LoremIpsum');
});
This would add a button into a Grid which would show you row's ID.
$grid->add('VirtualPage')
->addColumn('edit')
->set(function($page){
$id = $_GET[$page->short_name.'_id'];
$page->add('Text')->set('ID='.$id);
});
There are many other uses for VirtualPage, especially when you extract
it's URL.
$b = $page->add('Button')->set('Request new password');
$b->js('click')->univ()->location(
$this->add('VirtualPage')
->set(function($p){
$p->add('Text')->set('Check your email for confirmation');
})
->getURL()
);
(If you do this, be mindful of stickyGET arguments and don't call
from inside form's submit code
Simply returns a page we can put stuff on. This page would
be displayed instead of regular page, so beware.
public getPage ( ) : Page |
return |
Page |
page to be displayed |
$page protected_oe property
protected Page $page |
return |
Page |
|
$page_class public_oe property
public string $page_class |
return |
string |
|
$page_template public_oe property
public array|string $page_template |
return |
array | string |
|