TopPageSiteTreeExtension
class TopPageSiteTreeExtension extends Extension (View source)
This extension must be present on pagetypes that need to support Elemental TopPage functionality.
It can be applied directly to Page, as it only takes effect in the presence of a ElementalArea.
Properties
protected | T | $owner | The object this extension is applied to. |
from Extension |
protected | array | $duplicatedPages | List of pages currently undergoing duplication |
|
protected | array | $duplicatedObjects | List of objects that need to udate their top page reference |
Methods
Called when this extension is added to a particular class
Temporarily modify the owner. The original owner is ensured to be restored
Clear the current owner, and restore extension to the state prior to the last setOwner()
Helper method to strip eval'ed arguments from a string that's passed to DataObject::$extensions or Object::add_extension().
Invoke extension point. This will prefer explicit extend
prefixed
methods.
Registers the given object to receive an updated TopPage reference after the duplication operation completes, ensuring the new Page is written to the database beforehand.
Find currently duplicated page note: this doesn't change any stored data
Update top page reference during duplication process
Relevant only for duplicated object that were not written at the time of duplication
Elemental area is created before related page is written so we have to set top page explicitly after page is written and the relations are available
Details
__construct()
No description
static
add_to_class(string $class, string $extensionClass, mixed $args = null)
Called when this extension is added to a particular class
setOwner(object $owner)
Set the owner of this extension.
mixed
withOwner(mixed $owner, callable $callback, array $args = [])
Temporarily modify the owner. The original owner is ensured to be restored
clearOwner()
Clear the current owner, and restore extension to the state prior to the last setOwner()
T
getOwner()
Returns the owner of this extension.
static string
get_classname_without_arguments(string $extensionStr)
Helper method to strip eval'ed arguments from a string that's passed to DataObject::$extensions or Object::add_extension().
mixed
invokeExtension(object $owner, string $method, array ...$arguments)
Invoke extension point. This will prefer explicit extend
prefixed
methods.
protected void
onAfterWrite()
Extension point in DataObject::onAfterWrite()
protected void
onBeforeDuplicate(SiteTree $original)
Extension point in DataObject::duplicate()
protected void
onAfterDuplicate(SiteTree $original, bool $doWrite)
Extension point in DataObject::duplicate()
string|null
getDuplicationKey()
Generates a unique key for the page
void
addDuplicatedObject(DataObject $object)
Registers the given object to receive an updated TopPage reference after the duplication operation completes, ensuring the new Page is written to the database beforehand.
The registry uses a stack-like structure to allow accurate tracking of objects during duplication operations that include nested pages.
protected string|null
getDuplicatedPageKey()
Find currently duplicated page note: this doesn't change any stored data
protected void
initDuplication(SiteTree $original)
No description
protected void
processDuplication(SiteTree $original, bool $written)
Update top page reference during duplication process
protected void
processDuplicationFromOriginal()
Relevant only for duplicated object that were not written at the time of duplication
protected void
writeDuplication(SiteTree $original)
No description
protected void
setTopPageForElementalArea()
Elemental area is created before related page is written so we have to set top page explicitly after page is written and the relations are available