DNADesign\Elemental\TopPage\FluentExtension
Class FluentExtension
Use in place of @see DataExtension if you use the Fluent module for page localisation.
Be sure to also update @see TestState to use this extension
Synopsis
class FluentExtension
extends DataExtension
{
- // members
- private static array $db = ;
- // methods
- protected void assignTopPage()
- protected void clearTopPage()
- protected void assignFixedTopPage()
- protected void saveChanges()
- // Inherited methods from DataExtension
- public void onAfterWrite()
- public void onBeforeDuplicate()
- public void onAfterDuplicate()
- public Page|null getTopPage()
- public void setTopPage()
- public void getTopPageUpdate()
- public void enableTopPageUpdate()
- public void disableTopPageUpdate()
- public mixed withTopPageUpdate()
- public mixed withFixedTopPage()
- protected int getFixedTopPageID()
- protected void updateTopPage()
- protected void assignTopPage()
- protected void clearTopPage()
- protected void assignFixedTopPage()
- protected void saveChanges()
- protected Page|null getTopPageFromCachedData()
- protected string getTopPageTable()
Hierarchy
Members
private
- $db — array
Methods
protected
Inherited from DNADesign\Elemental\TopPage\DataExtension
protected
- assignFixedTopPage() — Assigns top page relation based on fixed id
- assignTopPage() — Assigns top page relation
- clearTopPage() — Clears top page relation, this is useful when duplicating object as the new object doesn't necessarily belong to the original page
- getFixedTopPageID() — Get the ID of a page which is currently set as the fixed top page
- getTopPageFromCachedData() — Perform a page lookup based on cached data This function allows more extensibility as it can be fully overridden unlike an extension point Various projects may decide to alter this by injecting features like tracking, feature flags and even completely different data lookups This is a performance driven functionality so extension points are not great as they only allow adding features on top of existing ones not replacing them
- getTopPageTable() — Find table name which has the top page fields
- saveChanges() — Save top page changes without using write() Using raw query here because: - this is already called during write() and triggering more write() related extension points is undesirable - we don't want to create a new version if object is versioned - using writeWithoutVersion() produces some weird edge cases were data is not written because the fields are not recognised as changed (using forceChange() introduces a new set of issues)
- updateTopPage() — Registers the object for a TopPage update. Ensures that this operation is deferred to a point when all required relations have been written.
public
- disableTopPageUpdate() — Global flag manipulation - disable automatic top page determination Useful for unit tests as you may want to enable / disable this feature based on need
- enableTopPageUpdate() — Global flag manipulation - enable automatic top page determination Useful for unit tests as you may want to enable / disable this feature based on need
- getTopPage() — Finds the top-level Page object for a Block / ElementalArea, using the cached TopPageID reference when possible.
- getTopPageUpdate()
- onAfterDuplicate() — Extension point in @see DataObject::duplicate()
- onAfterWrite() — Extension point in @see DataObject::onAfterWrite()
- onBeforeDuplicate() — Extension point in @see DataObject::duplicate()
- setTopPage() — Set top page to an object If no page is provided as an argument nor as a fixed id via @see DataExtension::withFixedTopPage() automatic page determination will be attempted Note that this may not always succeed as your model may not be attached to parent object at the time of this call
- withFixedTopPage() — Use this to wrap any code which is supposed to run with fixed top page Useful when top page is known upfront and doesn't need to be determined For example: model duplication where parent is assigned and saved only after the duplication is done It's not possible to determine top page in such case however it might be possible to know the top page even before the operation starts from the specific context Setting the page id to 0 disables this feature
- withTopPageUpdate() — Use this to wrap any code which is supposed to run with desired top page update setting Useful for unit tests as you may want to enable / disable this feature based on need