AssetControlExtension
class AssetControlExtension extends Extension (View source)
This class provides the necessary business logic to ensure that any assets attached to a record are safely deleted, published, or protected during certain operations.
This class will respect the canView() of each object, and will use it to determine whether or not public users can access attached assets. Public and live records will have their assets promoted to the public store.
Assets which exist only on non-live stages will be protected.
Assets which are no longer referenced will be flushed via explicit delete calls to the underlying filesystem.
Properties
| protected | T | $owner | The object this extension is applied to. | from Extension | 
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.
Ensure that deletes records remove their underlying file assets, without affecting other staged records.
Ensure that changes to records flush overwritten files, and update the visibility of other assets.
Given a set of asset manipulations, trigger any necessary publish, protect, or delete actions on each asset.
Checks all stages other than the current stage, and check the visibility of assets attached to those records.
Given a record, add all assets it contains to the given manipulation.
Return a list of all tuples attached to this dataobject Note: Variants are excluded
Determine if {Versioned) extension rules should be applied to this object
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        
    onAfterDelete()
        
    
    Ensure that deletes records remove their underlying file assets, without affecting other staged records.
        
                    protected        
    onBeforeWrite()
        
    
    Ensure that changes to records flush overwritten files, and update the visibility of other assets.
        
                    protected        string
    getRecordState(DataObject $record)
        
    
    Check default state of this record
        
                    protected        
    processManipulation(AssetManipulationList $manipulations)
        
    
    Given a set of asset manipulations, trigger any necessary publish, protect, or delete actions on each asset.
        
                    protected        
    addAssetsFromOtherStages(AssetManipulationList $manipulation)
        
    
    Checks all stages other than the current stage, and check the visibility of assets attached to those records.
        
                    protected        
    addAssetsFromRecord(AssetManipulationList $manipulation, DataObject $record, string $state)
        
    
    Given a record, add all assets it contains to the given manipulation.
State can be declared for this record, otherwise the underlying DataObject will be queried for canView() to see if those assets are public
        
                    protected        array
    findAssets(DataObject $record)
        
    
    Return a list of all tuples attached to this dataobject Note: Variants are excluded
        
                    protected        bool
    isVersioned()
        
    
    Determine if {Versioned) extension rules should be applied to this object
        
                    protected        
    deleteAll(array $assets)
        
    
    Delete all assets in the tuple list
        
                    protected        
    swapAll(array $assets)
        
    
    Move all assets in the list to the public store
        
                    protected        
    publishAll(array $assets)
        
    
    Move all assets in the list to the public store
        
                    protected        
    protectAll(array $assets)
        
    
    Move all assets in the list to the protected store
        
                    protected        AssetStore
    getAssetStore()
        
    
    No description