class VirtualPage extends Page (View source)

Virtual Page creates an instance of a page, with the same fields that the original page had, but readonly.

This allows you can have a page in mulitple places in the site structure, with different children without duplicating the content Note: This Only duplicates $db fields and not the $has_one etc..

Properties

static $virtualFields

Methods

getVirtualFields()

Generates the array of fields required for the page type.

CopyContentFrom()

No description

setCopyContentFromID($val)

No description

ContentSource()

No description

string
MetaTags(bool $includeTitle = true)

For VirtualPage, add a canonical link tag linking to the original page See TRAC #6828 & http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394

allowedChildren()

No description

syncLinkTracking()

No description

canPublish($member = null)

We can only publish the page if there is a published source page

canDeleteFromLive($member = null)

Return true if we can delete this page from the live site, which is different from can we publish it.

isPublishable()

Returns true if is page is publishable by anyone at all Return false if the source page isn't published yet.

getCMSFields()

Generate the CMS fields from the fields from the original page.

getSettingsFields()

No description

onBeforeWrite()

We have to change it to copy all the content from the original page first.

onAfterWrite()

No description

copyFrom($source, $updateImageTracking = true)

Ensure we have an up-to-date version of everything.

updateImageTracking()

No description

string
CMSTreeClasses(string $numChildrenMethod = "numChildren")

No description

mixed
__get(string $field)

Allow attributes on the master page to pass through to the virtual page

mixed
__isset(string $field)

Allow attributes on the master page to pass through to the virtual page

mixed
__call(string $method, string $args)

Pass unrecognized method calls on to the original data object

bool
hasField(string $field)

No description

bool
hasMethod(string $method)

Overwrite to also check for method on the original data object

string
castingHelper(string $field)

Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field on this object.

Details

getVirtualFields()

Generates the array of fields required for the page type.

SiteTree CopyContentFrom()

Return Value

SiteTree

Returns the linked page, or failing that, a new object.

setCopyContentFromID($val)

Parameters

$val

ContentSource()

string MetaTags(bool $includeTitle = true)

For VirtualPage, add a canonical link tag linking to the original page See TRAC #6828 & http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394

Parameters

bool $includeTitle

Show default -tag, set to false for custom templating</p></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td><p>The XHTML metatags</p></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_allowedChildren"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L114">at line 114</a></div> <code> <strong>allowedChildren</strong>() </code> </h3> <div class="details"> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_syncLinkTracking"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L120">at line 120</a></div> <code> <strong>syncLinkTracking</strong>() </code> </h3> <div class="details"> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_canPublish"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L131">at line 131</a></div> <code> <strong>canPublish</strong>($member = null) </code> </h3> <div class="details"> <div class="method-description"> <p><p>We can only publish the page if there is a published source page</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td></td> <td>$member</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_canDeleteFromLive"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L139">at line 139</a></div> <code> <strong>canDeleteFromLive</strong>($member = null) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Return true if we can delete this page from the live site, which is different from can we publish it.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td></td> <td>$member</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_isPublishable"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L149">at line 149</a></div> <code> <strong>isPublishable</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns true if is page is publishable by anyone at all Return false if the source page isn't published yet.</p></p> <p><p>Note that isPublishable doesn't affect ete from live, only publish.</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_getCMSFields"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L167">at line 167</a></div> <code> <strong>getCMSFields</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Generate the CMS fields from the fields from the original page.</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_getSettingsFields"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L233">at line 233</a></div> <code> <strong>getSettingsFields</strong>() </code> </h3> <div class="details"> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_onBeforeWrite"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L256">at line 256</a></div> <code> <strong>onBeforeWrite</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>We have to change it to copy all the content from the original page first.</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_onAfterWrite"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L299">at line 299</a></div> <code> <strong>onAfterWrite</strong>() </code> </h3> <div class="details"> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_copyFrom"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L369">at line 369</a></div> <code> <strong>copyFrom</strong>($source, $updateImageTracking = true) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Ensure we have an up-to-date version of everything.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td></td> <td>$source</td> <td></td> </tr> <tr> <td></td> <td>$updateImageTracking</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_updateImageTracking"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L387">at line 387</a></div> <code> <strong>updateImageTracking</strong>() </code> </h3> <div class="details"> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_CMSTreeClasses"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L402">at line 402</a></div> <code> string <strong>CMSTreeClasses</strong>(string $numChildrenMethod = "numChildren") </code> </h3> <div class="details"> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$numChildrenMethod</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method___get"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L413">at line 413</a></div> <code> mixed <strong>__get</strong>(string $field) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Allow attributes on the master page to pass through to the virtual page</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$field</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>mixed</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method___isset"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L431">at line 431</a></div> <code> mixed <strong>__isset</strong>(string $field) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Allow attributes on the master page to pass through to the virtual page</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$field</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>mixed</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method___call"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L448">at line 448</a></div> <code> mixed <strong>__call</strong>(string $method, string $args) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Pass unrecognized method calls on to the original data object</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$method</td> <td></td> </tr> <tr> <td>string</td> <td>$args</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>mixed</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_hasField"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L460">at line 460</a></div> <code> bool <strong>hasField</strong>(string $field) </code> </h3> <div class="details"> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$field</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_hasMethod"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L473">at line 473</a></div> <code> bool <strong>hasMethod</strong>(string $method) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Overwrite to also check for method on the original data object</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$method</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_castingHelper"> <div class="location"><a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/VirtualPage.php#L487">at line 487</a></div> <code> string <strong>castingHelper</strong>(string $field) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field on this object.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$field</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> </div> </div><div id="footer"> Generated by <a href="https://github.com/code-lts/doctum">Doctum, a API Documentation generator and fork of Sami</a>. <br/>Contributions to this documentation repository are welcomed <a href="https://github.com/silverstripe/api.silverstripe.org" rel="noreferrer noopener" target="_blank">on Github!</a> </div></div> </div> </body> </html>