Commit 3e4b3d9e authored by Tom Keitel's avatar Tom Keitel
Browse files

Issue #3281815 by hctom, zcht: Drupal 10 compatibility

parent 50fa9d86
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
  "license": "GPL-2.0-or-later",
  "minimum-stability": "dev",
  "require-dev": {
    "drupal/diff": "^1.0",
    "drupal/diff": "^1.1",
    "drupal/paragraphs": "^1.12"
  }
}
+0 −8
Original line number Diff line number Diff line
@@ -106,19 +106,11 @@ class ViewModeSwitchDiffTest extends ViewModeSwitchTestBase {
   *
   * Tests that a diff is displayed when changes are made in a view mode switch
   * field.
   *
   * @group legacy
   */
  public function testViewModeSwitchDiff(): void {
    $page = $this->getSession()->getPage();
    $this->assertTrue(TRUE);

    // Avoid failing tests because of deprecation message caused by 'diff'
    // contrib module.
    $this->expectDeprecation('The core/jquery.once asset library is deprecated in Drupal 9.3.0 and will be removed in Drupal 10.0.0. Use the core/once library instead. See https://www.drupal.org/node/3158256');
    $this->expectDeprecation('The "access_check.node.revision" service is deprecated. You should use the \'access_check.entity\' service instead. See https://www.drupal.org/node/3161210');
    $this->expectDeprecation('NodeRevisionAccessCheck is deprecated in drupal:9.3.0 and will be removed before drupal:10.0.0. Use "_entity_access" requirement with relevant operation instead. See https://www.drupal.org/node/3161210');

    // Ensure view mode switch field diff plugin is set.
    $this->drupalGet('admin/config/content/diff/fields');
    $page->selectFieldOption('fields[node__' . $this->fieldVms->getName() . '][plugin][type]', 'view_mode_switch_field_diff_builder');
+0 −6
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@ class ParagraphsWidgetTest extends ViewModeSwitchTestBase {

  /**
   * Test paragraphs experimental widget's preview when switching its view mode.
   *
   * @group legacy
   */
  public function testParagraphsWidgetPreview(): void {
    $page = $this->getSession()->getPage();
@@ -109,10 +107,6 @@ class ParagraphsWidgetTest extends ViewModeSwitchTestBase {
      ])
      ->save();

    // Avoid failing tests because of deprecation message caused by 'paragraphs'
    // contrib module.
    $this->expectDeprecation('Javascript Deprecation: jQuery.once() is deprecated in Drupal 9.3.0 and will be removed in Drupal 10.0.0. Use the core/once library instead. See https://www.drupal.org/node/3158256');

    // Go to node create form and test paragraphs widget's preview output when
    // switching view modes.
    $this->drupalGet('node/add/' . $node_bundle);
+1 −1
Original line number Diff line number Diff line
@@ -2,6 +2,6 @@ name: 'View Mode Switch Field'
type: module
description: 'Provides a field type that allows editors to switch view modes.'
package: Field types
core_version_requirement: ^9
core_version_requirement: ^9 || ^10
dependencies:
  - drupal:field
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ function view_mode_switch_entity_view_mode_predelete(EntityInterface $entity): v
/**
 * Implements hook_entity_view_mode_alter().
 */
function view_mode_switch_entity_view_mode_alter(string &$view_mode, EntityInterface $entity, array $context): void {
function view_mode_switch_entity_view_mode_alter(string &$view_mode, EntityInterface $entity): void {
  // Is fieldable entity?
  if ($entity instanceof FieldableEntityInterface) {
    /** @var \Drupal\view_mode_switch\ViewModeSwitchInterface $view_mode_switch */