Is there a simple, elegant way to obtain the ID of the page containing a widget, from within that widget?
I've figured out how to get the ID of the WidgetArea, but not the containing page.
Anyone have any ideas they could throw at me? For some reason this is more difficult than I first thought it would be...
class TestWidget extends Widget
{
static $db = array(
'MyValue' => 'Varchar'
);
static $title = "Test Widget";
static $cmsTitle = "Test Widget Widget";
static $description = "A widget to test with.";
// Method to handle generation of form fields for selection of widget content
function getCMSFields()
{
$TxtFld = new TextField( "MyValue", "My Value" );
return new FieldSet( $TxtFld );
}
function GetContainerPageID()
{
return $this->parent()->ID; // This only returns the ID of the WidgetArea...
}
}