diff --git a/config/schema/content_lock.schema.yml b/config/schema/content_lock.schema.yml index da30f47..e6fdc9d 100644 --- a/config/schema/content_lock.schema.yml +++ b/config/schema/content_lock.schema.yml @@ -17,14 +17,17 @@ content_lock.settings: type: sequence label: 'Entity types with translation lock on' form_op_lock: - type: mapping - mapping: - mode: - type: integer - label: 'Disabled / blacklist / whitelist mode per entity type' - values: - type: sequence - label: 'Whitelisted / blacklisted form operations per entity type' - sequence: - type: string - label: 'form operation' + type: sequence + label: 'Entity types' + sequence: + type: mapping + mapping: + mode: + type: integer + label: 'Disabled / blacklist / whitelist mode per entity type' + values: + type: sequence + label: 'Whitelisted / blacklisted form operations per entity type' + sequence: + type: string + label: 'form operation' diff --git a/content_lock.install b/content_lock.install index a27bef8..efafb4e 100644 --- a/content_lock.install +++ b/content_lock.install @@ -5,6 +5,7 @@ * Create content_lock table. */ +use Drupal\Core\Database\Database; use Drupal\Core\Language\LanguageInterface; /** @@ -73,3 +74,32 @@ function content_lock_schema() { return $schema; } + +/** + * Add new schema for form op and translation locks. + */ +function content_lock_update_8001() { + $schema = Database::getConnection()->schema(); + $table_name = 'content_lock'; + $new_columns = [ + 'form_op' => [ + 'description' => 'The entity form operation.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '*', + ], + 'langcode' => [ + 'description' => 'The language code of the entity.', + 'type' => 'varchar_ascii', + 'length' => 12, + 'not null' => TRUE, + 'default' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + ], + ]; + foreach ($new_columns as $column_name => $spec) { + if (!$schema->fieldExists($table_name, $column_name)) { + $schema->addField($table_name, $column_name, $spec); + } + } +} diff --git a/src/ContentLock/ContentLock.php b/src/ContentLock/ContentLock.php index b230811..b44cdb8 100644 --- a/src/ContentLock/ContentLock.php +++ b/src/ContentLock/ContentLock.php @@ -494,7 +494,7 @@ class ContentLock extends ServiceProviderBase { * @throws \InvalidArgumentException * An exception will be thrown if the */ - public function locking($entity_id, $langcode, $uid, $entity_type = 'node', $quiet = FALSE) { + public function locking($entity_id, $langcode, $form_op, $uid, $entity_type = 'node', $quiet = FALSE) { $translation_lock = $this->isTranslationLockEnabled($entity_type); if (!$translation_lock) { $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;