comparison core/lib/Drupal/Core/Render/Renderer.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
324 '#create_placeholder', 324 '#create_placeholder',
325 // The keys below are not actually supported, but these are added 325 // The keys below are not actually supported, but these are added
326 // automatically by the Renderer. Adding them as though they are 326 // automatically by the Renderer. Adding them as though they are
327 // supported allows us to avoid throwing an exception 100% of the time. 327 // supported allows us to avoid throwing an exception 100% of the time.
328 '#weight', 328 '#weight',
329 '#printed' 329 '#printed',
330 ]; 330 ];
331 $unsupported_keys = array_diff(array_keys($elements), $supported_keys); 331 $unsupported_keys = array_diff(array_keys($elements), $supported_keys);
332 if (count($unsupported_keys)) { 332 if (count($unsupported_keys)) {
333 throw new \DomainException(sprintf('When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: %s.', implode(', ', $unsupported_keys))); 333 throw new \DomainException(sprintf('When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: %s.', implode(', ', $unsupported_keys)));
334 } 334 }
647 // The 'status messages' placeholder needs to be special cased, because it 647 // The 'status messages' placeholder needs to be special cased, because it
648 // depends on global state that can be modified when other placeholders are 648 // depends on global state that can be modified when other placeholders are
649 // being rendered: any code can add messages to render. 649 // being rendered: any code can add messages to render.
650 // This violates the principle that each lazy builder must be able to render 650 // This violates the principle that each lazy builder must be able to render
651 // itself in isolation, and therefore in any order. However, we cannot 651 // itself in isolation, and therefore in any order. However, we cannot
652 // change the way drupal_set_message() works in the Drupal 8 cycle. So we 652 // change the way \Drupal\Core\Messenger\Messenger works in the Drupal 8
653 // have to accommodate its special needs. 653 // cycle. So we have to accommodate its special needs.
654 // Allowing placeholders to be rendered in a particular order (in this case: 654 // Allowing placeholders to be rendered in a particular order (in this case:
655 // last) would violate this isolation principle. Thus a monopoly is granted 655 // last) would violate this isolation principle. Thus a monopoly is granted
656 // to this one special case, with this hard-coded solution. 656 // to this one special case, with this hard-coded solution.
657 // @see \Drupal\Core\Render\Element\StatusMessages 657 // @see \Drupal\Core\Render\Element\StatusMessages
658 // @see https://www.drupal.org/node/2712935#comment-11368923 658 // @see https://www.drupal.org/node/2712935#comment-11368923