You are here

public function Workflow::isDeletable in Workflow 7.2

Returns if the Workflow may be deleted.

Return value

bool $is_deletable TRUE if a Workflow may safely be deleted.

Overrides WorkflowInterface::isDeletable

File

includes/Entity/Workflow.php, line 314
Contains workflow\includes\Entity\Workflow. Contains workflow\includes\Entity\WorkflowController.

Class

Workflow

Code

public function isDeletable() {
  $is_deletable = FALSE;

  // May not be deleted if a TypeMap exists.
  if ($this
    ->getTypeMap()) {
    return $is_deletable;
  }

  // May not be deleted if assigned to a Field.
  foreach (_workflow_info_fields() as $field) {
    if ($field['settings']['wid'] == $this->wid) {
      return $is_deletable;
    }
  }

  // May not be deleted if a State is assigned to a state.
  foreach ($this
    ->getStates(TRUE) as $state) {
    if ($state
      ->count()) {
      return $is_deletable;
    }
  }
  $is_deletable = TRUE;
  return $is_deletable;
}