You are here

public function WorkflowTypeAttributeTrait::getWorkflowId in Workflow 8

Returns the Workflow ID of this object.

Return value

string Workflow Id.

8 calls to WorkflowTypeAttributeTrait::getWorkflowId()
WorkflowConfigTransition::isAllowed in src/Entity/WorkflowConfigTransition.php
Determines if the current transition between 2 states is allowed.
WorkflowState::calculateDependencies in src/Entity/WorkflowState.php
Calculates dependencies and stores them in the dependency property.
WorkflowState::deactivate in src/Entity/WorkflowState.php
Deactivate a Workflow State, moving existing content to a given State.
WorkflowState::getTransitions in src/Entity/WorkflowState.php
Returns the allowed transitions for the current state.
WorkflowState::save in src/Entity/WorkflowState.php
Saves an entity permanently.

... See full list

File

src/WorkflowTypeAttributeTrait.php, line 84

Class

WorkflowTypeAttributeTrait
Wrapper methods for Workflow* objects.

Namespace

Drupal\workflow

Code

public function getWorkflowId() {

  /** @var \Drupal\Core\Entity\ContentEntityBase $this */
  if (!empty($this->wid)) {
    return $this->wid;
  }
  $value = $this
    ->get('wid');
  if (is_string($value)) {
    $this->wid = $value;
  }
  elseif (is_object($value)) {

    // In WorkflowTransition.
    $wid = isset($value
      ->getValue()[0]['target_id']) ? $value
      ->getValue()[0]['target_id'] : '';
    $this->wid = $wid;
  }
  else {
    workflow_debug(__FILE__, __FUNCTION__, __LINE__, '', '');
  }
  return $this->wid;
}