Verified Commit a8ca27f4 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3337195 by Spokje: Rename test theme test_legacy_theme

(cherry picked from commit bad33160)
parent 68530cb6
Loading
Loading
Loading
Loading
+0 −44
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Theme to test functionality of legacy theme functions.
 *
 * @todo Remove in https://www.drupal.org/project/drupal/issues/3097889
 */

/**
 * Tests a theme overriding a suggestion of a base theme hook.
 */
function test_legacy_theme_theme_test_preprocess_suggestions__kitten__meerkat($variables) {
  return 'Theme hook implementor=test_theme_theme_test__suggestion(). Foo=' . $variables['foo'];
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function test_legacy_theme_theme_suggestions_theme_test_function_suggestions_alter(array &$suggestions, array $variables) {
  // Theme alter hooks run after module alter hooks, so add this theme
  // suggestion to the beginning of the array so that the suggestion added by
  // the theme_suggestions_test module can be picked up when that module is
  // enabled.
  array_unshift($suggestions, 'theme_test_function_suggestions__' . 'theme_override');
}

/**
 * Returns HTML for a theme function suggestion test.
 *
 * Implements the theme_test_function_suggestions__theme_override suggestion.
 */
function test_legacy_theme_theme_test_function_suggestions__theme_override($variables) {
  return 'Theme function overridden based on new theme suggestion provided by the test_legacy_theme theme.';
}

/**
 * Returns HTML for a theme function suggestion test.
 *
 * Implements the theme_test_function_suggestions__module_override suggestion.
 */
function test_legacy_theme_theme_test_function_suggestions__module_override($variables) {
  return 'Theme function overridden based on new theme suggestion provided by a module.';
}
+3 −3
Original line number Diff line number Diff line
name: 'Test legacy theme'
name: 'Test theme with deprecated libraries'
type: theme
description: 'Test theme to test deprecated functionality.'
description: 'Test theme to test themes with deprecated libraries.'
version: VERSION
package: Testing
base theme: test_theme
@@ -13,4 +13,4 @@ libraries-override:

libraries-extend:
  theme_test/another_deprecated_library:
    - test_legacy_theme/library
    - test_theme_with_deprecated_libraries/library
+0 −0

File moved.

+1 −1
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ public function testDeprecatedLibrary() {
    $this->expectDeprecation('Theme "theme_test" is extending a deprecated library. The "theme_test/another_deprecated_library" asset library is deprecated in drupal:X.0.0 and is removed from drupal:Y.0.0. Use another library instead. See https://www.example.com');
    $this->expectDeprecation('The "theme_test/deprecated_library" asset library is deprecated in drupal:X.0.0 and is removed from drupal:Y.0.0. Use another library instead. See https://www.example.com');
    $this->expectDeprecation('The "theme_test/another_deprecated_library" asset library is deprecated in drupal:X.0.0 and is removed from drupal:Y.0.0. Use another library instead. See https://www.example.com');
    $this->activateTheme('test_legacy_theme');
    $this->activateTheme('test_theme_with_deprecated_libraries');
    $this->libraryDiscovery->getLibraryByName('theme_test', 'deprecated_library');
    $this->libraryDiscovery->getLibraryByName('theme_test', 'another_deprecated_library');
  }