Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Entity/EntityDisplayBase.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 7a779792577d |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
188 $options['region'] = 'hidden'; | 188 $options['region'] = 'hidden'; |
189 @trigger_error("Specifying 'type' => 'hidden' is deprecated, use 'region' => 'hidden' instead.", E_USER_DEPRECATED); | 189 @trigger_error("Specifying 'type' => 'hidden' is deprecated, use 'region' => 'hidden' instead.", E_USER_DEPRECATED); |
190 } | 190 } |
191 | 191 |
192 if (!empty($options['region']) && $options['region'] === 'hidden') { | 192 if (!empty($options['region']) && $options['region'] === 'hidden') { |
193 $this->hidden[$name] = TRUE; | 193 $this->removeComponent($name); |
194 } | 194 } |
195 elseif ($options) { | 195 elseif ($options) { |
196 $options += ['region' => $default_region]; | 196 $options += ['region' => $default_region]; |
197 $this->content[$name] = $this->pluginManager->prepareConfiguration($definition->getType(), $options); | 197 $this->setComponent($name, $options); |
198 } | 198 } |
199 // Note: (base) fields that do not specify display options are not | 199 // Note: (base) fields that do not specify display options are not |
200 // tracked in the display at all, in order to avoid cluttering the | 200 // tracked in the display at all, in order to avoid cluttering the |
201 // configuration that gets saved back. | 201 // configuration that gets saved back. |
202 } | 202 } |
248 } | 248 } |
249 | 249 |
250 /** | 250 /** |
251 * {@inheritdoc} | 251 * {@inheritdoc} |
252 */ | 252 */ |
253 public function preSave(EntityStorageInterface $storage, $update = TRUE) { | 253 public function preSave(EntityStorageInterface $storage) { |
254 // Ensure that a region is set on each component. | 254 // Ensure that a region is set on each component. |
255 foreach ($this->getComponents() as $name => $component) { | 255 foreach ($this->getComponents() as $name => $component) { |
256 $this->handleHiddenType($name, $component); | 256 $this->handleHiddenType($name, $component); |
257 // Ensure that a region is set. | 257 // Ensure that a region is set. |
258 if (isset($this->content[$name]) && !isset($component['region'])) { | 258 if (isset($this->content[$name]) && !isset($component['region'])) { |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 ksort($this->content); | 264 ksort($this->content); |
265 ksort($this->hidden); | 265 ksort($this->hidden); |
266 parent::preSave($storage, $update); | 266 parent::preSave($storage); |
267 } | 267 } |
268 | 268 |
269 /** | 269 /** |
270 * Handles a component type of 'hidden'. | 270 * Handles a component type of 'hidden'. |
271 * | 271 * |