comparison core/includes/module.inc @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
12 * 12 *
13 * @param $type 13 * @param $type
14 * The type of list to return: 14 * The type of list to return:
15 * - theme: All installed themes. 15 * - theme: All installed themes.
16 * 16 *
17 * @return 17 * @return array
18 * An associative array of themes, keyed by name. 18 * An associative array of themes, keyed by name.
19 * For $type 'theme', the array values are objects representing the 19 * For $type 'theme', the array values are objects representing the
20 * respective database row, with the 'info' property already unserialized. 20 * respective database row, with the 'info' property already unserialized.
21 * 21 *
22 * @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use
23 * \Drupal::service('theme_handler')->listInfo() instead.
24 *
25 * @see https://www.drupal.org/node/2709919
22 * @see \Drupal\Core\Extension\ThemeHandler::listInfo() 26 * @see \Drupal\Core\Extension\ThemeHandler::listInfo()
23 */ 27 */
24 function system_list($type) { 28 function system_list($type) {
25 $lists = &drupal_static(__FUNCTION__); 29 @trigger_error('system_list() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal::service(\'theme_handler\')->listInfo() instead. See https://www.drupal.org/node/2709919', E_USER_DEPRECATED);
26 if ($cached = \Drupal::cache('bootstrap')->get('system_list')) { 30
27 $lists = $cached->data; 31 $lists = [
28 } 32 'theme' => \Drupal::service('theme_handler')->listInfo(),
29 else { 33 'filepaths' => [],
30 $lists = [ 34 ];
31 'theme' => [], 35 foreach ($lists['theme'] as $name => $theme) {
32 'filepaths' => [], 36 $lists['filepaths'][] = [
37 'type' => 'theme',
38 'name' => $name,
39 'filepath' => $theme->getPathname(),
33 ]; 40 ];
34 // ThemeHandler maintains the 'system.theme.data' state record. 41 }
35 $theme_data = \Drupal::state()->get('system.theme.data', []);
36 foreach ($theme_data as $name => $theme) {
37 $lists['theme'][$name] = $theme;
38 $lists['filepaths'][] = [
39 'type' => 'theme',
40 'name' => $name,
41 'filepath' => $theme->getPathname(),
42 ];
43 }
44 \Drupal::cache('bootstrap')->set('system_list', $lists);
45 }
46 // To avoid a separate database lookup for the filepath, prime the
47 // drupal_get_filename() static cache with all enabled themes.
48 foreach ($lists['filepaths'] as $item) {
49 system_register($item['type'], $item['name'], $item['filepath']);
50 }
51
52 return $lists[$type]; 42 return $lists[$type];
53 } 43 }
54 44
55 /** 45 /**
56 * Resets all system_list() caches. 46 * Resets all system_list() caches.
47 *
48 * @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. There
49 * is no direct replacement. Call each
50 * \Drupal::service('extension.list.TYPE')->reset() as necessary.
51 *
52 * @see https://www.drupal.org/node/2709919
57 */ 53 */
58 function system_list_reset() { 54 function system_list_reset() {
59 drupal_static_reset('system_list'); 55 @trigger_error("system_list_reset() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. There is no direct replacement. Call each \Drupal::service('extension.list.TYPE')->reset() as necessary. See https://www.drupal.org/node/2709919.", E_USER_DEPRECATED);
56 \Drupal::service('extension.list.profile')->reset();
60 \Drupal::service('extension.list.module')->reset(); 57 \Drupal::service('extension.list.module')->reset();
61 \Drupal::cache('bootstrap')->delete('system_list'); 58 \Drupal::service('extension.list.theme_engine')->reset();
59 \Drupal::service('extension.list.theme')->reset();
62 } 60 }
63 61
64 /** 62 /**
65 * Registers an extension in runtime registries for execution. 63 * Registers an extension in runtime registries for execution.
66 * 64 *