Commit 82c2baf6 authored by Volker Killesreiter's avatar Volker Killesreiter Committed by Christian Fritsch
Browse files

Issue #3266071 by chr.fritsch, volkerk, alanmoreira, Tauany Bueno,...

Issue #3266071 by chr.fritsch, volkerk, alanmoreira, Tauany Bueno, beatrizramos: Drupal 10 compatibility
parent d8414205
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -4,10 +4,8 @@
  "type": "drupal-module",
  "license": "GPL-2.0-or-later",
  "require": {
    "drupal/core": "^8.8|^9.0"
    "drupal/core": "^9.0 || ^10.0"
  },
  "require-dev": {
    "drupal/prefetch_cache": "dev-1.x",
    "drupal/conflict": "^2.0@ALPHA"
  }
}
+1 −3
Original line number Diff line number Diff line
@@ -2,10 +2,8 @@ name: Content Lock
description: 'Prevents multiple users from trying to edit a content entity simultaneously to prevent edit conflicts.'
type: module
package: Content
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^9 || ^10
configure: content_lock.settings

test_dependencies:
  - prefetch_cache:prefetch_cache
  - drupal:content_translation
  - conflict:conflict
+11 −3
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
 * Create content_lock table.
 */

use Drupal\Core\Database\Database;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Entity\EntityTypeInterface;

@@ -77,8 +76,17 @@ function content_lock_schema() {
 * Reinstall database schema.
 */
function content_lock_update_8001(&$sandbox) {
  drupal_uninstall_schema('content_lock');
  drupal_install_schema('content_lock');
  // Uninstall table.
  $table = 'content_lock';
  $schema = \Drupal::database()->schema();
  if ($schema->tableExists($table)) {
    $schema->dropTable($table);
  }

  // Install table.
  $name = 'content_lock';
  $table = content_lock_schema();
  \Drupal::database()->schema()->createTable($name, $table);
}

/**
+3 −2
Original line number Diff line number Diff line
drupal.content_lock.settings:
  version: VERSION
  js:
    js/content_lock_settings.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/once
drupal.content_lock.lock_form:
  js:
    js/content_lock_form.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/jquery.once
    - core/once
+4 −4
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ function content_lock_form_alter(&$form, FormStateInterface $form_state, $form_i
  if (!$form_state->getFormObject() instanceof EntityFormInterface) {
    return;
  }
  /** @var \Drupal\core\Entity\ContentEntityInterface $entity */
  /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
  $entity = $form_state->getFormObject()->getEntity();
  $entity_type = $entity->getEntityTypeId();
  $user = Drupal::currentUser();
@@ -149,7 +149,7 @@ function content_lock_form_submit($form, FormStateInterface $form_state) {

  /** @var \Drupal\content_lock\ContentLock\ContentLock $lock_service */
  $lock_service = \Drupal::service('content_lock');
  /** @var \Drupal\core\Entity\ContentEntityInterface $entity */
  /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
  $entity = $form_state->getFormObject()->getEntity();

  // If the user submitting owns the lock, release it.
@@ -393,9 +393,9 @@ function content_lock_entity_operation(EntityInterface $entity) {
 */
function content_lock_theme() {
  return [
    'content_lock_settings_entities' => array(
    'content_lock_settings_entities' => [
      'render element' => 'element',
    ),
    ],
  ];
}

Loading