comparison core/lib/Drupal/Core/Theme/ActiveTheme.php @ 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
49 49
50 /** 50 /**
51 * An array of base theme active theme objects keyed by name. 51 * An array of base theme active theme objects keyed by name.
52 * 52 *
53 * @var static[] 53 * @var static[]
54 *
55 * @deprecated in Drupal 8.7.0 and will be removed before Drupal 9. Use
56 * $this->baseThemeExtensions instead.
57 *
58 * @see https://www.drupal.org/node/3019948
54 */ 59 */
55 protected $baseThemes; 60 protected $baseThemes;
61
62 /**
63 * An array of base theme extension objects keyed by name.
64 *
65 * @var \Drupal\Core\Extension\Extension[]
66 */
67 protected $baseThemeExtensions = [];
56 68
57 /** 69 /**
58 * The extension object. 70 * The extension object.
59 * 71 *
60 * @var \Drupal\Core\Extension\Extension 72 * @var \Drupal\Core\Extension\Extension
109 'owner' => 'twig', 121 'owner' => 'twig',
110 'logo' => '', 122 'logo' => '',
111 'stylesheets_remove' => [], 123 'stylesheets_remove' => [],
112 'libraries' => [], 124 'libraries' => [],
113 'extension' => 'html.twig', 125 'extension' => 'html.twig',
114 'base_themes' => [], 126 'base_theme_extensions' => [],
115 'regions' => [], 127 'regions' => [],
116 'libraries_override' => [], 128 'libraries_override' => [],
117 'libraries_extend' => [], 129 'libraries_extend' => [],
118 ]; 130 ];
119 131
123 $this->engine = $values['engine']; 135 $this->engine = $values['engine'];
124 $this->owner = $values['owner']; 136 $this->owner = $values['owner'];
125 $this->styleSheetsRemove = $values['stylesheets_remove']; 137 $this->styleSheetsRemove = $values['stylesheets_remove'];
126 $this->libraries = $values['libraries']; 138 $this->libraries = $values['libraries'];
127 $this->extension = $values['extension']; 139 $this->extension = $values['extension'];
128 $this->baseThemes = $values['base_themes']; 140 $this->baseThemeExtensions = $values['base_theme_extensions'];
141 if (!empty($values['base_themes']) && empty($this->baseThemeExtensions)) {
142 @trigger_error("The 'base_themes' key is deprecated in Drupal 8.7.0 and support for it will be removed in Drupal 9.0.0. Use 'base_theme_extensions' instead. See https://www.drupal.org/node/3019948", E_USER_DEPRECATED);
143 foreach ($values['base_themes'] as $base_theme) {
144 $this->baseThemeExtensions[$base_theme->getName()] = $base_theme->getExtension();
145 }
146 }
147
129 $this->regions = $values['regions']; 148 $this->regions = $values['regions'];
130 $this->librariesOverride = $values['libraries_override']; 149 $this->librariesOverride = $values['libraries_override'];
131 $this->librariesExtend = $values['libraries_extend']; 150 $this->librariesExtend = $values['libraries_extend'];
132 } 151 }
133 152
159 } 178 }
160 179
161 /** 180 /**
162 * Returns the path to the theme engine for root themes. 181 * Returns the path to the theme engine for root themes.
163 * 182 *
164 * @see \Drupal\Core\Extension\ThemeHandler::rebuildThemeData 183 * @see \Drupal\Core\Extension\ThemeExtensionList::doList()
165 * 184 *
166 * @return mixed 185 * @return mixed
167 */ 186 */
168 public function getOwner() { 187 public function getOwner() {
169 return $this->owner; 188 return $this->owner;
205 * 224 *
206 * The order starts with the base theme of $this and ends with the root of 225 * The order starts with the base theme of $this and ends with the root of
207 * the dependency chain. 226 * the dependency chain.
208 * 227 *
209 * @return static[] 228 * @return static[]
229 *
230 * @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use
231 * \Drupal\Core\Theme\ActiveTheme::getBaseThemeExtensions() instead.
232 *
233 * @see https://www.drupal.org/node/3019948
210 */ 234 */
211 public function getBaseThemes() { 235 public function getBaseThemes() {
212 return $this->baseThemes; 236 @trigger_error('\Drupal\Core\Theme\ActiveTheme::getBaseThemes() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Theme\ActiveTheme::getBaseThemeExtensions() instead. See https://www.drupal.org/node/3019948', E_USER_DEPRECATED);
237 /** @var \Drupal\Core\Theme\ThemeInitialization $theme_initialisation */
238 $theme_initialisation = \Drupal::service('theme.initialization');
239 $base_themes = array_combine(array_keys($this->baseThemeExtensions), array_keys($this->baseThemeExtensions));
240 return array_map([$theme_initialisation, 'getActiveThemeByName'], $base_themes);
241 }
242
243 /**
244 * Returns an array of base theme extension objects keyed by name.
245 *
246 * The order starts with the base theme of $this and ends with the root of
247 * the dependency chain.
248 *
249 * @return \Drupal\Core\Extension\Extension[]
250 */
251 public function getBaseThemeExtensions() {
252 return $this->baseThemeExtensions;
213 } 253 }
214 254
215 /** 255 /**
216 * Returns the logo provided by the theme. 256 * Returns the logo provided by the theme.
217 * 257 *