Abstract Class humhub\modules\stream\actions\Stream

Inheritancehumhub\modules\stream\actions\Stream » yii\base\Action
Subclasseshumhub\modules\activity\actions\ActivityStreamAction, humhub\modules\content\components\actions\ContentContainerStream, humhub\modules\dashboard\components\actions\DashboardStreamAction, humhub\modules\directory\components\UserPostsStreamAction, humhub\modules\stream\actions\ContentContainerStream
Available since version0.11

Stream is the basic action for content streams.

JSON output structure:

 content             - array, content id is key
      id             - int, id of content
      guid           - string, guid of content
      pinned         - boolean, is content pinned
      archived       - boolean, i scontent is archived
      output         - string, the rendered html output of content
 total               - int, total of content records
 isLast              - boolean, is last content
 contentOrder        - array, list of content ids

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
afterRun() This method is called right after run() is executed. humhub\modules\stream\actions\Stream
beforeRun() This method is called right before run() is executed. humhub\modules\stream\actions\Stream
isInitialRequest() Is inital stream requests (show first stream content) humhub\modules\stream\actions\Stream
setActionSettings() humhub\modules\stream\actions\Stream

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_AFTER_RUN \yii\base\ActionEvent Event triggered after this action is run. (available since version 1.1.1) humhub\modules\stream\actions\Stream
EVENT_BEFORE_RUN \yii\base\ActionEvent Event triggered before this action is run. (available since version 1.1.1) humhub\modules\stream\actions\Stream

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
FROM_DASHBOARD 'dashboard' humhub\modules\stream\actions\Stream
MAX_LIMIT 50 Maximum wall entries per request humhub\modules\stream\actions\Stream
MODE_ACTIVITY 'activity' humhub\modules\stream\actions\Stream
MODE_NORMAL 'normal' Modes humhub\modules\stream\actions\Stream
SORT_CREATED_AT 'c' Constants used for sorting humhub\modules\stream\actions\Stream
SORT_UPDATED_AT 'u' humhub\modules\stream\actions\Stream

Property Details

$activeQuery public property
public \yii\db\ActiveQuery $activeQuery null
$contentId public property (available since version 1.2)
public $contentId null
$excludes public property (available since version 1.2)
public array $excludes = []
$filters public property
public array $filters = []
$from public property
public integer $from null
$includes public property (available since version 1.2)
public array $includes = []
$limit public property
public integer $limit 4
$mode public property
public string $mode null
$sort public property
public integer $sort null
$streamQuery protected property (available since version 1.2)
$streamQueryClass public property

Suppress similar content types in a row

public string $streamQueryClass = \humhub\modules\stream\models\WallStreamQuery::class
$user public property

Method Details

afterRun() protected method

This method is called right after run() is executed.

You may override this method to do post-processing work for the action run.

protected void afterRun ( )
beforeRun() protected method

This method is called right before run() is executed.

You may override this method to do preparation work for the action run. If the method returns false, it will cancel the action.

protected boolean beforeRun ( )
return boolean

Whether to run the action.

getContentResultEntry() public static method

Returns an array contains all informations required to display a content in stream.

public static array getContentResultEntry ( humhub\modules\content\models\Content $content )
$content humhub\modules\content\models\Content

The content

throws \yii\base\Exception
init() public method

public void init ( )
isInitialRequest() protected method

Is inital stream requests (show first stream content)

protected boolean isInitialRequest ( )
return boolean

Is initial request

renderEntry() public static method

Renders the wallEntry of the given ContentActiveRecord.

If setting $partial to false this function will use the renderAjax function instead of renderPartial, which will directly append all dependencies to the result and if not used in a real ajax request will also append the Layoutadditions.

Render options can be provided by setting the $options array. This array will be passed to the WallEntryWidget implementation of the given ContentActiveRecord. The render option array can for example be used to deactivate the rendering of the the WallEntryControls, Addons etc.

The used jsWidget implementation of the WallEntry can be overwritten by $options['jsWidget'].

e.g:

Stream::renderEntry($myModel, [
     'jsWidget' => 'my.namespace.StreamEntry',
     'renderControls' => false
]);

The previous example deactivated the rendering of the WallEntryControls and set a specific property of the WallEntryWidget related to $myModel.

public static string renderEntry ( humhub\modules\content\components\ContentActiveRecord $record, $options = [], $partial true )
$record humhub\modules\content\components\ContentActiveRecord

Content record instance

$options

Array render options

$partial boolean

Whether or not to use renderPartial over renderAjax

return string

Rendered wallentry

throws Exception
run() public method

public void run ( )
setActionSettings() protected method

protected void setActionSettings ( )
setupCriteria() public method

public void setupCriteria ( )
setupFilters() public method

public void setupFilters ( )

Event Details

EVENT_AFTER_RUN event of type \yii\base\ActionEvent (available since version 1.1.1)

Event triggered after this action is run.

EVENT_BEFORE_RUN event of type \yii\base\ActionEvent (available since version 1.1.1)

Event triggered before this action is run. This can be used for example to customize $activeQuery before it gets executed.