Movable
in
This interface can be implemented by Models which can be moved to a [[ContentContainerActiveRecord]]
Tags
Table of Contents
Methods
- afterMove() : mixed
- This function is called once the actual move logic has been performed.
- canMove() : bool|string
- Defines if this instance is movable and either returns true or a string indicating why the instance can't be moved.
- move() : bool
- Implements the actual logic for moving the instance to the given [[ContentContainerActiveRecord]].
Methods
afterMove()
This function is called once the actual move logic has been performed.
public
afterMove([ContentContainerActiveRecord $container = null ]) : mixed
Parameters
- $container : ContentContainerActiveRecord = null
canMove()
Defines if this instance is movable and either returns true or a string indicating why the instance can't be moved.
public
canMove([ContentContainerActiveRecord|null $container = null ]) : bool|string
If a [[ContentContainerActiveRecord]] is given this function may adds container specific checks as permission or visibility checks.
Thus, instances may be movable but only to certain containers.
Parameters
- $container : ContentContainerActiveRecord|null = null
-
the target container
Return values
bool|string —either true in case the instance can be moved, otherwise a string indicating why the instance can't be moved
move()
Implements the actual logic for moving the instance to the given [[ContentContainerActiveRecord]].
public
move([ContentContainerActiveRecord|null $container = null ][, bool $force = false ]) : bool
If supported by the implementation a null [[ContentContainerActiveRecord]] can be set to detach the instance from the current [[ContentContainerActiveRecord]].
In case a null [[ContentContainerActiveRecord]] is not supported by the implementation but given, this function should return false.
By default this function should make use of the [[canMove()]] validation before executing the actual move logic
unless the $force
parameter is set to true.
This function may call [[afterMove()]] once the move has been performed successfully.
Parameters
- $container : ContentContainerActiveRecord|null = null
- $force : bool = false