function ContentModerationState::__construct

Same name in other branches
  1. 9 core/modules/content_moderation/src/ContentModerationState.php \Drupal\content_moderation\ContentModerationState::__construct()
  2. 8.9.x core/modules/content_moderation/src/ContentModerationState.php \Drupal\content_moderation\ContentModerationState::__construct()
  3. 11.x core/modules/content_moderation/src/ContentModerationState.php \Drupal\content_moderation\ContentModerationState::__construct()

ContentModerationState constructor.

Decorates state objects to add methods to determine if an entity should be published or made the default revision.

Parameters

\Drupal\workflows\StateInterface $state: The vanilla state object from the Workflow module.

bool $published: (optional) TRUE if entities should be published if in this state, FALSE if not. Defaults to FALSE.

bool $default_revision: (optional) TRUE if entities should be the default revision if in this state, FALSE if not. Defaults to FALSE.

File

core/modules/content_moderation/src/ContentModerationState.php, line 48

Class

ContentModerationState
A value object representing a workflow state for content moderation.

Namespace

Drupal\content_moderation

Code

public function __construct(StateInterface $state, $published = FALSE, $default_revision = FALSE) {
    $this->state = $state;
    $this->published = $published;
    $this->defaultRevision = $default_revision;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.