You are here

public function ContentLock::release in Content locking (anti-concurrent editing) 8.2

Same name and namespace in other branches
  1. 8 src/ContentLock/ContentLock.php \Drupal\content_lock\ContentLock\ContentLock::release()

Release a locked entity.

Parameters

int $entity_id: The entity id.

string $langcode: The translation language code of the entity.

string $form_op: (optional) The entity form operation.

int $uid: If set, verify that a lock belongs to this user prior to release.

string $entity_type: The entity type.

File

src/ContentLock/ContentLock.php, line 258

Class

ContentLock
Class ContentLock.

Namespace

Drupal\content_lock\ContentLock

Code

public function release($entity_id, $langcode, $form_op = NULL, $uid = NULL, $entity_type = 'node') {
  if (!$this
    ->isTranslationLockEnabled($entity_type)) {
    $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
  }
  if (!$this
    ->isFormOperationLockEnabled($entity_type)) {
    $form_op = '*';
  }

  // Delete locking item from database.
  $this
    ->lockingDelete($entity_id, $langcode, $form_op, $uid, $entity_type);
  $this->moduleHandler
    ->invokeAll('content_lock_release', [
    $entity_id,
    $langcode,
    $form_op,
    $entity_type,
  ]);
}