Interface humhub\modules\content\models\Movable

Implemented byhumhub\modules\activity\models\Activity, humhub\modules\content\components\ContentActiveRecord, humhub\modules\content\models\Content, humhub\modules\post\models\Post
Available since version1.3

This interface can be implemented by Models which can be moved to a humhub\modules\content\components\ContentContainerActiveRecord

Public Methods

Hide inherited methods

MethodDescriptionDefined By
afterMove() This function is called once the actual move logic has been performed. humhub\modules\content\models\Movable
canMove() Defines if this instance is movable and either returns true or a string indicating why the instance can't be moved. humhub\modules\content\models\Movable
move() Implements the actual logic for moving the instance to the given humhub\modules\content\components\ContentContainerActiveRecord. humhub\modules\content\models\Movable

Method Details

afterMove() public abstract method

This function is called once the actual move logic has been performed.

public abstract void afterMove ( humhub\modules\content\components\ContentContainerActiveRecord $container null )
$container
canMove() public abstract method

Defines if this instance is movable and either returns true or a string indicating why the instance can't be moved.

If a humhub\modules\content\components\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.

public abstract boolean|string canMove ( humhub\modules\content\components\ContentContainerActiveRecord $container null )
$container humhub\modules\content\components\ContentContainerActiveRecord|null

The target container

return boolean|string

Either true in case the instance can be moved, otherwise a string indicating why the instance can't be moved

move() public abstract method

Implements the actual logic for moving the instance to the given humhub\modules\content\components\ContentContainerActiveRecord.

If supported by the implementation a null humhub\modules\content\components\ContentContainerActiveRecord can be set to detach the instance from the current humhub\modules\content\components\ContentContainerActiveRecord.

In case a null humhub\modules\content\components\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.

public abstract boolean move ( humhub\modules\content\components\ContentContainerActiveRecord $container null, $force false )
$container humhub\modules\content\components\ContentContainerActiveRecord|null
$force boolean