You are here

class Workflow in Workflow 8

Same name in this branch
  1. 8 src/Entity/Workflow.php \Drupal\workflow\Entity\Workflow
  2. 8 src/Feeds/Target/Workflow.php \Drupal\workflow\Feeds\Target\Workflow

Workflow configuration entity to persistently store configuration.

Plugin annotation


@ConfigEntityType(
  id = "workflow_type",
  label = @Translation("Workflow type"),
  label_singular = @Translation("Workflow type"),
  label_plural = @Translation("Workflow types"),
  label_count = @PluralTranslation(
    singular = "@count Workflow type",
    plural = "@count Workflow types",
  ),
  module = "workflow",
  static_cache = TRUE,
  translatable = TRUE,
  handlers = {
    "storage" = "Drupal\workflow\Entity\WorkflowStorage",
    "list_builder" = "Drupal\workflow\WorkflowListBuilder",
    "form" = {
       "add" = "Drupal\workflow\Form\WorkflowTypeForm",
       "delete" = "Drupal\Core\Entity\EntityDeleteForm",
       "edit" = "Drupal\workflow\Form\WorkflowTypeForm",
     }
  },
  admin_permission = "administer workflow",
  config_prefix = "workflow",
  bundle_of = "workflow_transition",
  entity_keys = {
    "id" = "id",
    "label" = "label",
  },
  config_export = {
    "id",
    "label",
    "module",
    "status",
    "options",
  },
  links = {
    "canonical" = "/admin/config/workflow/workflow/{workflow_type}",
    "collection" = "/admin/config/workflow/workflow",
    "delete-form" = "/admin/config/workflow/workflow/{workflow_type}/delete",
    "edit-form" = "/admin/config/workflow/workflow/{workflow_type}",
  },
)

Hierarchy

Expanded class hierarchy of Workflow

7 files declare their use of Workflow
workflow.module in ./workflow.module
Support workflows made up of arbitrary states.
WorkflowDefaultWidget.php in src/Plugin/Field/FieldWidget/WorkflowDefaultWidget.php
WorkflowItem.php in src/Plugin/Field/FieldType/WorkflowItem.php
WorkflowPermissions.php in src/WorkflowPermissions.php
WorkflowStateActionBase.php in src/Plugin/Action/WorkflowStateActionBase.php

... See full list

13 string references to 'Workflow'
workflow.info.yml in ./workflow.info.yml
workflow.info.yml
workflow.links.menu.yml in ./workflow.links.menu.yml
workflow.links.menu.yml
workflow.schema.yml in config/schema/workflow.schema.yml
config/schema/workflow.schema.yml
workflowfield.info.yml in modules/workflow_field/workflowfield.info.yml
modules/workflow_field/workflowfield.info.yml
WorkflowLocalTask::getDerivativeDefinitions in src/Plugin/Derivative/WorkflowLocalTask.php
Gets the definition of all derivatives of a base plugin.

... See full list

File

src/Entity/Workflow.php, line 59

Namespace

Drupal\workflow\Entity
View source
class Workflow extends ConfigEntityBase implements WorkflowInterface {

  /*
   * Provide URL route parameters for entity links.
   */
  use MessengerTrait;
  use StringTranslationTrait;
  use WorkflowURLRouteParametersTrait;

  /**
   * The machine name.
   *
   * @var string
   */
  public $id;

  /**
   * The human readable name.
   *
   * @var string
   */
  public $label;

  /**
   * The Workflow settings (which would be a better name).
   *
   * @var array
   */
  public $options = [];

  /**
   * The workflow-specific creation state.
   *
   * @var \Drupal\workflow\Entity\WorkflowState
   */
  private $creation_state = NULL;

  /**
   * The workflow-specific creation state ID.
   *
   * @var string
   */
  private $creation_sid = 0;

  /**
   * Attached States.
   *
   * @var \Drupal\workflow\Entity\WorkflowState[]
   */
  public $states = [];

  /**
   * Attached Transitions.
   *
   * @var \Drupal\workflow\Entity\WorkflowConfigTransitionInterface[]
   */
  public $transitions = [];

  /**
   * The module implementing this object, for config_export.
   *
   * @var string
   */
  protected $module = 'workflow';

  /**
   * CRUD functions.
   */

  /**
   * Given information, update or insert a new workflow.
   *
   * This also handles importing, rebuilding, reverting from Features,
   * as defined in workflow.features.inc.
   *
   * @todo D8: Clean up this function, since we are config entity now.
   *
   * When changing this function, test with the following situations:
   * - maintain Workflow in Admin UI;
   * - clone Workflow in Admin UI;
   * - create/revert/rebuild Workflow with Features; @see workflow.features.inc
   * - save Workflow programmatically;
   *
   * @inheritdoc
   */
  public function save() {
    $status = parent::save();

    // Make sure a Creation state exists, when saving a Workflow.
    if ($status == SAVED_NEW) {
      $this
        ->getCreationState();
    }
    return $status;
  }

  /**
   * {@inheritdoc}
   */
  public static function postLoad(EntityStorageInterface $storage, array &$entities) {

    /** @var \Drupal\workflow\Entity\Workflow $workflow */
    foreach ($entities as &$workflow) {

      // Better performance, together with Annotation static_cache = TRUE.
      // Load the states, and set the creation state.
      $workflow
        ->getStates();
      $workflow
        ->getCreationState();
    }
  }

  /**
   * Given a wid, delete the workflow and its data.
   */
  public function delete() {
    if (!$this
      ->isDeletable()) {
      $message = $this
        ->t('Workflow %workflow is not Deletable. Please delete the field where this workflow type is referred', [
        '%workflow' => $this
          ->label(),
      ]);
      $this
        ->messenger()
        ->addError($message);
      return;
    }
    else {

      // Delete associated state (also deletes any associated transitions).
      foreach ($this
        ->getStates(TRUE) as $state) {
        $state
          ->deactivate('');
        $state
          ->delete();
      }

      // Delete the workflow.
      parent::delete();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function isValid() {
    $is_valid = TRUE;

    // Don't allow Workflow without states.
    // There should always be a creation state.
    $states = $this
      ->getStates(FALSE);
    if (count($states) < 1) {

      // That's all, so let's remind them to create some states.
      $message = $this
        ->t('Workflow %workflow has no states defined, so it cannot be assigned to content yet.', [
        '%workflow' => $this
          ->label(),
      ]);
      $this
        ->messenger()
        ->addWarning($message);

      // Skip allowing this workflow.
      $is_valid = FALSE;
    }

    // Also check for transitions, at least out of the creation state.
    // Don't filter for roles.
    $transitions = $this
      ->getTransitionsByStateId($this
      ->getCreationSid(), '');
    if (count($transitions) < 1) {

      // That's all, so let's remind them to create some transitions.
      $message = $this
        ->t('Workflow %workflow has no transitions defined, so it cannot be assigned to content yet.', [
        '%workflow' => $this
          ->label(),
      ]);
      $this
        ->messenger()
        ->addWarning($message);

      // Skip allowing this workflow.
      $is_valid = FALSE;
    }
    return $is_valid;
  }

  /**
   * {@inheritdoc}
   */
  public function isDeletable() {

    // May not be deleted if assigned to a Field.
    foreach (_workflow_info_fields() as $field_info) {
      if ($field_info
        ->getSetting('workflow_type') == $this
        ->id()) {
        return FALSE;
      }
    }
    return TRUE;
  }

  /**
   * Property functions.
   */

  /**
   * {@inheritdoc}
   */
  public function getWorkflowId() {
    return $this
      ->id();
  }

  /**
   * {@inheritdoc}
   */
  public function createState($sid, $save = TRUE) {
    $wid = $this
      ->id();

    /** @var \Drupal\workflow\Entity\WorkflowState $state */
    $state = WorkflowState::load($sid);
    if (!$state || $wid != $state
      ->getWorkflowId()) {
      $values = [
        'id' => $sid,
        'wid' => $wid,
      ];
      $state = WorkflowState::create($values);
      if ($save) {
        $state
          ->save();
      }
    }

    // Maintain the new object in the workflow.
    $this->states[$state
      ->id()] = $state;
    return $state;
  }

  /**
   * {@inheritdoc}
   */
  public function getCreationState() {

    // First, find it.
    if (!$this->creation_state) {
      foreach ($this
        ->getStates(TRUE) as $state) {
        if ($state
          ->isCreationState()) {
          $this->creation_state = $state;
          $this->creation_sid = $state
            ->id();
        }
      }
    }

    // Then, create it.
    if (\Drupal::isConfigSyncing()) {

      // Do not create the default state while configuration are importing.
    }
    elseif (!$this->creation_state) {
      $state = $this
        ->createState(WORKFLOW_CREATION_STATE_NAME);
      $this->creation_state = $state;
      $this->creation_sid = $state
        ->id();
    }
    return $this->creation_state;
  }

  /**
   * {@inheritdoc}
   */
  public function getCreationSid() {
    if (!$this->creation_sid) {
      $state = $this
        ->getCreationState();
      return $state
        ->id();
    }
    return $this->creation_sid;
  }

  /**
   * {@inheritdoc}
   */
  public function getFirstSid(EntityInterface $entity, $field_name, AccountInterface $user, $force = FALSE) {
    $creation_state = $this
      ->getCreationState();
    $options = $creation_state
      ->getOptions($entity, $field_name, $user, $force);
    if ($options) {
      $keys = array_keys($options);
      $sid = $keys[0];
    }
    else {

      // This should never happen, but it did during testing.
      $this
        ->messenger()
        ->addError($this
        ->t('There are no workflow states available. Please notify your site administrator.'));
      $sid = 0;
    }
    return $sid;
  }

  /**
   * {@inheritdoc}
   */
  public function getNextSid(EntityInterface $entity, $field_name, AccountInterface $user, $force = FALSE) {
    $current_sid = WorkflowManager::getCurrentStateId($entity, $field_name);

    /** @var \Drupal\workflow\Entity\WorkflowState $current_state */
    $current_state = WorkflowState::load($current_sid);
    $options = $current_state
      ->getOptions($entity, $field_name, $user, $force);

    // Loop over every option. To find the next one.
    $flag = $current_state
      ->isCreationState();
    $new_sid = $current_state
      ->id();
    foreach ($options as $sid => $name) {
      if ($flag) {
        $new_sid = $sid;
        break;
      }
      if ($sid == $current_state
        ->id()) {
        $flag = TRUE;
      }
    }
    return $new_sid;
  }

  /**
   * {@inheritdoc}
   */
  public function getStates($all = FALSE, $reset = FALSE) {
    $wid = $this
      ->id();
    if ($reset) {
      $this->states = $wid ? WorkflowState::loadMultiple([], $wid, $reset) : [];
    }
    elseif ($this->states === NULL) {
      $this->states = $wid ? WorkflowState::loadMultiple([], $wid, $reset) : [];
    }
    elseif ($this->states === []) {
      $this->states = $wid ? WorkflowState::loadMultiple([], $wid, $reset) : [];
    }

    // Do not unset, but add to array - you'll remove global objects otherwise.
    $states = [];
    foreach ($this->states as $state) {
      $id = $state
        ->id();
      if ($all === TRUE) {
        $states[$id] = $state;
      }
      elseif ($all === FALSE && ($state
        ->isActive() && !$state
        ->isCreationState())) {
        $states[$id] = $state;
      }
      elseif ($all == 'CREATION' && ($state
        ->isActive() || $state
        ->isCreationState())) {
        $states[$id] = $state;
      }
      else {

        // Do not add state.
      }
    }
    return $states;
  }

  /**
   * {@inheritdoc}
   */
  public function getState($sid) {
    $wid = $this
      ->id();
    $state = WorkflowState::load($sid);
    if (!$wid || $wid == $state
      ->getWorkflowId()) {
      return $state;
    }
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function createTransition($from_sid, $to_sid, array $values = []) {
    $config_transition = NULL;

    // First check if this transition already exists.
    $transitions = $this
      ->getTransitionsByStateId($from_sid, $to_sid);
    if ($transitions) {
      $config_transition = reset($transitions);
    }
    else {
      $values['wid'] = $this
        ->id();
      $values['from_sid'] = $from_sid;
      $values['to_sid'] = $to_sid;
      $config_transition = WorkflowConfigTransition::create($values);
      $config_transition
        ->save();
    }

    // Maintain the new object in the workflow.
    $this->transitions[$config_transition
      ->id()] = $config_transition;
    return $config_transition;
  }

  /**
   * {@inheritdoc}
   */
  public function sortTransitions() {

    // Sort the transitions on state weight.
    uasort($this->transitions, [
      'Drupal\\workflow\\Entity\\WorkflowConfigTransition',
      'sort',
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function getTransitions(array $ids = NULL, array $conditions = []) {
    $config_transitions = [];

    // Get filters on 'from' states, 'to' states, roles.
    $from_sid = isset($conditions['from_sid']) ? $conditions['from_sid'] : FALSE;
    $to_sid = isset($conditions['to_sid']) ? $conditions['to_sid'] : FALSE;

    // Get valid states + creation state.
    $states = $this
      ->getStates('CREATION');

    // Cache all transitions in the workflow.
    if (!$this->transitions) {
      $this->transitions = WorkflowConfigTransition::loadMultiple($ids);
      $this
        ->sortTransitions();
    }

    /** @var \Drupal\workflow\Entity\WorkflowConfigTransition $config_transition */
    foreach ($this->transitions as &$config_transition) {
      if (!isset($states[$config_transition
        ->getFromSid()])) {

        // Not a valid transition for this workflow. @todo Delete them.
      }
      elseif ($from_sid && $from_sid != $config_transition
        ->getFromSid()) {

        // Not the requested 'from' state.
      }
      elseif ($to_sid && $to_sid != $config_transition
        ->getToSid()) {

        // Not the requested 'to' state.
      }
      else {

        // Transition is allowed, permitted. Add to list.
        $config_transitions[$config_transition
          ->id()] = $config_transition;
      }
    }
    return $config_transitions;
  }

  /**
   * {@inheritdoc}
   */
  public function getTransitionsById($tid) {
    return $this
      ->getTransitions([
      $tid,
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function getTransitionsByStateId($from_sid, $to_sid) {
    $conditions = [
      'from_sid' => $from_sid,
      'to_sid' => $to_sid,
    ];
    return $this
      ->getTransitions(NULL, $conditions);
  }

  /*
   * The following is copied from interface PluginSettingsInterface.
   */

  /**
   * Whether default settings have been merged into the current $settings.
   *
   * @var bool
   */
  protected $defaultSettingsMerged = FALSE;

  /**
   * {@inheritdoc}
   */
  public static function defaultSettings() {
    return [
      'name_as_title' => 0,
      'fieldset' => 0,
      'options' => 'radios',
      'schedule_enable' => 1,
      'schedule_timezone' => 1,
      'always_update_entity' => 0,
      'comment_log_node' => '1',
      'watchdog_log' => TRUE,
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getSettings() {

    // Merge defaults before returning the array.
    if (!$this->defaultSettingsMerged) {
      $this
        ->mergeDefaults();
    }
    return $this->options;
  }

  /**
   * {@inheritdoc}
   */
  public function getSetting($key) {

    // Merge defaults if we have no value for the key.
    if (!$this->defaultSettingsMerged && !array_key_exists($key, $this->options)) {
      $this
        ->mergeDefaults();
    }
    return isset($this->options[$key]) ? $this->options[$key] : NULL;
  }

  /**
   * Merges default settings values into $settings.
   */
  protected function mergeDefaults() {
    $this->options += static::defaultSettings();
    $this->defaultSettingsMerged = TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function setSettings(array $settings) {
    $this->options = $settings;
    $this->defaultSettingsMerged = FALSE;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setSetting($key, $value) {
    $this->options[$key] = $value;
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
ConfigEntityBase::$isUninstalling private property Whether the config is being deleted by the uninstall process.
ConfigEntityBase::$langcode protected property The language code of the entity's default language.
ConfigEntityBase::$originalId protected property The original ID of the configuration entity.
ConfigEntityBase::$status protected property The enabled/disabled status of the configuration entity. 4
ConfigEntityBase::$third_party_settings protected property Third party entity settings.
ConfigEntityBase::$trustedData protected property Trust supplied data and not use configuration schema on save.
ConfigEntityBase::$uuid protected property The UUID for this entity.
ConfigEntityBase::$_core protected property Information maintained by Drupal core about configuration.
ConfigEntityBase::addDependency protected function Overrides \Drupal\Core\Entity\DependencyTrait:addDependency().
ConfigEntityBase::calculateDependencies public function Calculates dependencies and stores them in the dependency property. Overrides ConfigEntityInterface::calculateDependencies 13
ConfigEntityBase::createDuplicate public function Creates a duplicate of the entity. Overrides EntityBase::createDuplicate 1
ConfigEntityBase::disable public function Disables the configuration entity. Overrides ConfigEntityInterface::disable 1
ConfigEntityBase::enable public function Enables the configuration entity. Overrides ConfigEntityInterface::enable
ConfigEntityBase::get public function Returns the value of a property. Overrides ConfigEntityInterface::get
ConfigEntityBase::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityBase::getCacheTagsToInvalidate 1
ConfigEntityBase::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityBase::getConfigDependencyName
ConfigEntityBase::getConfigManager protected static function Gets the configuration manager.
ConfigEntityBase::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityBase::getConfigTarget
ConfigEntityBase::getDependencies public function Gets the configuration dependencies. Overrides ConfigEntityInterface::getDependencies
ConfigEntityBase::getOriginalId public function Gets the original ID. Overrides EntityBase::getOriginalId
ConfigEntityBase::getThirdPartyProviders public function Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface::getThirdPartyProviders
ConfigEntityBase::getThirdPartySetting public function Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface::getThirdPartySetting
ConfigEntityBase::getThirdPartySettings public function Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface::getThirdPartySettings
ConfigEntityBase::getTypedConfig protected function Gets the typed config manager.
ConfigEntityBase::hasTrustedData public function Gets whether on not the data is trusted. Overrides ConfigEntityInterface::hasTrustedData
ConfigEntityBase::invalidateTagsOnDelete protected static function Override to never invalidate the individual entities' cache tags; the config system already invalidates them. Overrides EntityBase::invalidateTagsOnDelete
ConfigEntityBase::invalidateTagsOnSave protected function Override to never invalidate the entity's cache tag; the config system already invalidates it. Overrides EntityBase::invalidateTagsOnSave
ConfigEntityBase::isInstallable public function Checks whether this entity is installable. Overrides ConfigEntityInterface::isInstallable 2
ConfigEntityBase::isNew public function Overrides Entity::isNew(). Overrides EntityBase::isNew
ConfigEntityBase::isUninstalling public function Returns whether this entity is being changed during the uninstall process. Overrides ConfigEntityInterface::isUninstalling
ConfigEntityBase::link public function Deprecated way of generating a link to the entity. See toLink(). Overrides EntityBase::link
ConfigEntityBase::onDependencyRemoval public function Informs the entity that entities it depends on will be deleted. Overrides ConfigEntityInterface::onDependencyRemoval 7
ConfigEntityBase::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides EntityBase::preDelete 8
ConfigEntityBase::preSave public function Acts on an entity before the presave hook is invoked. Overrides EntityBase::preSave 13
ConfigEntityBase::set public function Sets the value of a property. Overrides ConfigEntityInterface::set
ConfigEntityBase::setOriginalId public function Sets the original ID. Overrides EntityBase::setOriginalId
ConfigEntityBase::setStatus public function Sets the status of the configuration entity. Overrides ConfigEntityInterface::setStatus
ConfigEntityBase::setThirdPartySetting public function Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface::setThirdPartySetting
ConfigEntityBase::setUninstalling public function
ConfigEntityBase::sort public static function Helper callback for uasort() to sort configuration entities by weight and label. 6
ConfigEntityBase::status public function Returns whether the configuration entity is enabled. Overrides ConfigEntityInterface::status 4
ConfigEntityBase::toArray public function Gets an array of all property values. Overrides EntityBase::toArray 2
ConfigEntityBase::toUrl public function Gets the URL object for the entity. Overrides EntityBase::toUrl
ConfigEntityBase::trustData public function Sets that the data should be trusted. Overrides ConfigEntityInterface::trustData
ConfigEntityBase::unsetThirdPartySetting public function Unsets a third-party setting. Overrides ThirdPartySettingsInterface::unsetThirdPartySetting
ConfigEntityBase::url public function Gets the public URL for this entity. Overrides EntityBase::url
ConfigEntityBase::urlInfo public function Gets the URL object for the entity. Overrides EntityBase::urlInfo
ConfigEntityBase::__construct public function Constructs an Entity object. Overrides EntityBase::__construct 10
ConfigEntityBase::__sleep public function Overrides EntityBase::__sleep 4
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Aliased as: traitSleep 1
DependencySerializationTrait::__wakeup public function 2
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency. Aliased as: addDependencyTrait
EntityBase::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
EntityBase::$entityTypeId protected property The entity type.
EntityBase::$typedData protected property A typed data object wrapping this entity.
EntityBase::access public function Checks data value access. Overrides AccessibleInterface::access 1
EntityBase::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle 1
EntityBase::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
EntityBase::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
EntityBase::entityManager Deprecated protected function Gets the entity manager.
EntityBase::entityTypeBundleInfo protected function Gets the entity type bundle info service.
EntityBase::entityTypeManager protected function Gets the entity type manager.
EntityBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
EntityBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
EntityBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
EntityBase::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
EntityBase::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
EntityBase::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
EntityBase::getListCacheTagsToInvalidate protected function The list cache tags to invalidate for this entity.
EntityBase::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
EntityBase::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
EntityBase::id public function Gets the identifier. Overrides EntityInterface::id 11
EntityBase::label public function Gets the label of the entity. Overrides EntityInterface::label 6
EntityBase::language public function Gets the language of the entity. Overrides EntityInterface::language 1
EntityBase::languageManager protected function Gets the language manager.
EntityBase::linkTemplates protected function Gets an array link templates. 1
EntityBase::load public static function Loads an entity. Overrides EntityInterface::load
EntityBase::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
EntityBase::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate 4
EntityBase::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface::postDelete 16
EntityBase::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides EntityInterface::postSave 14
EntityBase::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 5
EntityBase::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities 1
EntityBase::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
EntityBase::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityBase::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid 1
EntityBase::uuidGenerator protected function Gets the UUID generator.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance.
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. 1
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
SynchronizableEntityTrait::$isSyncing protected property Whether this entity is being created, updated or deleted through a synchronization process.
SynchronizableEntityTrait::isSyncing public function
SynchronizableEntityTrait::setSyncing public function
Workflow::$creation_sid private property The workflow-specific creation state ID.
Workflow::$creation_state private property The workflow-specific creation state.
Workflow::$defaultSettingsMerged protected property Whether default settings have been merged into the current $settings.
Workflow::$id public property The machine name.
Workflow::$label public property The human readable name.
Workflow::$module protected property The module implementing this object, for config_export.
Workflow::$options public property The Workflow settings (which would be a better name).
Workflow::$states public property Attached States.
Workflow::$transitions public property Attached Transitions.
Workflow::createState public function Create a new state for this workflow. Overrides WorkflowInterface::createState
Workflow::createTransition public function Creates a Transition for this workflow. Overrides WorkflowInterface::createTransition
Workflow::defaultSettings public static function Defines the default settings for this plugin. Overrides WorkflowInterface::defaultSettings
Workflow::delete public function Given a wid, delete the workflow and its data. Overrides EntityBase::delete
Workflow::getCreationSid public function Gets the ID of the initial state for a newly created entity. Overrides WorkflowInterface::getCreationSid
Workflow::getCreationState public function Gets the initial state for a newly created entity. Overrides WorkflowInterface::getCreationState
Workflow::getFirstSid public function Gets the first valid state ID, after the creation state. Overrides WorkflowInterface::getFirstSid
Workflow::getNextSid public function Returns the next state for the current state. Overrides WorkflowInterface::getNextSid
Workflow::getSetting public function Returns the value of a setting, or its default value if absent. Overrides WorkflowInterface::getSetting
Workflow::getSettings public function Returns the array of settings, including defaults for missing settings. Overrides WorkflowInterface::getSettings
Workflow::getState public function Gets a state for a given workflow. Overrides WorkflowInterface::getState
Workflow::getStates public function Gets all states for a given workflow. Overrides WorkflowInterface::getStates
Workflow::getTransitions public function Loads all allowed ConfigTransitions for this workflow. Overrides WorkflowInterface::getTransitions
Workflow::getTransitionsById public function Overrides WorkflowInterface::getTransitionsById
Workflow::getTransitionsByStateId public function Get a specific transition. Overrides WorkflowInterface::getTransitionsByStateId
Workflow::getWorkflowId public function Returns the workflow id. Overrides WorkflowInterface::getWorkflowId
Workflow::isDeletable public function Returns if the Workflow may be deleted. Overrides WorkflowInterface::isDeletable
Workflow::isValid public function Validate the workflow. Generate a message if not correct. Overrides WorkflowInterface::isValid
Workflow::mergeDefaults protected function Merges default settings values into $settings.
Workflow::postLoad public static function Acts on loaded entities. Overrides EntityBase::postLoad
Workflow::save public function Given information, update or insert a new workflow. Overrides ConfigEntityBase::save
Workflow::setSetting public function Sets the value of a setting for the plugin. Overrides WorkflowInterface::setSetting
Workflow::setSettings public function Sets the settings for the plugin. Overrides WorkflowInterface::setSettings
Workflow::sortTransitions public function Sorts all Transitions for this workflow, according to State weight. Overrides WorkflowInterface::sortTransitions
WorkflowURLRouteParametersTrait::urlRouteParameters protected function