@trigger_error("The global hide() function is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. To hide form elements, use ['#access'] = FALSE. For render elements, use ['#printed'] = TRUE. See https://www.drupal.org/node/3261271",E_USER_DEPRECATED);
$element['#printed']=TRUE;
return$element;
}
@@ -306,17 +304,8 @@ function hide(&$element) {
/**
* Shows a hidden element for later rendering.
*
* You can also use render($element), which shows the element while rendering
* it.
*
* The first time render() or RenderInterface::render() is called on an element
* tree, as each element in the tree is rendered, it is marked with a #printed
* flag and the rendered children of the element are cached. Subsequent calls to
* render() or RenderInterface::render() will not traverse the child tree of
* this element again: they will just use the cached children. So if you want to
* show an element, be sure to call show() on the element before its parent tree
* is rendered for the first time, as it will have no effect on subsequent
* renderings of the parent tree.
* Refer to \Drupal\Core\Render\RendererInterface::render()
* for additional documentation.
*
* @param array $element
* The element to be shown.
@@ -324,11 +313,15 @@ function hide(&$element) {
* @return array
* The element.
*
* @see \Drupal\Core\Render\RendererInterface
* @see render()
* @see hide()
* @deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. To show form
* elements, use ['#access'] = TRUE. For render elements, use
@trigger_error("The global show() function is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. To show form elements, use ['#access'] = TRUE. For render elements, use ['#printed'] = FALSE. See https://www.drupal.org/node/3261271",E_USER_DEPRECATED);
* Tests the deprecation of the global hide() function.
*/
publicfunctiontestHideDeprecation():void{
$element=[];
$this->expectUserDeprecationMessage("The global hide() function is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. To hide form elements, use ['#access'] = FALSE. For render elements, use ['#printed'] = TRUE. See https://www.drupal.org/node/3261271");
* Tests the deprecation of the global show() function.
*/
publicfunctiontestShowDeprecation():void{
$element=[];
$this->expectUserDeprecationMessage("The global show() function is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. To show form elements, use ['#access'] = TRUE. For render elements, use ['#printed'] = FALSE. See https://www.drupal.org/node/3261271");