The following functions have been refactored into methods on the Element class, all calls should be replaced with direct calls to the methods specified in their docblocks:

element_property($key)
element_properties($element)
element_child($key)
element_children(&$elements, $sort = FALSE)
element_get_visible_children(array $elements)
element_set_attributes(array &$element, array $map)

Comments

grom358’s picture

StatusFileSize
new73.87 KB

Using Function Replacer Part of Write script to automate replacement of deprecated functions where possible.

$ function_replace.php element_property 'Drupal\Core\Render\Element' RenderElement property
$ function_replace.php element_properties 'Drupal\Core\Render\Element' RenderElement properties
$ function_replace.php element_child 'Drupal\Core\Render\Element' RenderElement child
$ function_replace.php element_children 'Drupal\Core\Render\Element' RenderElement children
$ function_replace.php element_get_visible_children 'Drupal\Core\Render\Element' RenderElement getVisibleChildren
$ function_replace.php element_set_attributes 'Drupal\Core\Render\Element' RenderElement setAttributes
grom358’s picture

Status: Active » Needs review
grom358’s picture

I think this issue is duplicate of https://drupal.org/comment/8592499#comment-8592499

ianthomas_uk’s picture

Issue tags: +Core Review Bonus

I've marked that as a duplicate of this, and I'm stealing its Core Review Bonus tag.

ianthomas_uk’s picture

I've not reviewed the patch itself, but those function_replace commands look correct

ianthomas_uk’s picture

Status: Needs review » Needs work

Needs reroll. I tried, using the commands above, but got

$ function_replace.php element_property 'Drupal\Core\Render\Element' RenderElement property
PHP Fatal error:  Function name must be a string in /Users/ian/d8codetools/src/FileUtil.php on line 19
grom358’s picture

Status: Needs work » Needs review
StatusFileSize
new78.36 KB

Ian what version of PHP you on?

ianthomas_uk’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new4.76 KB
new79.11 KB

A few comments needed to be wrapped to 80 chars, but otherwise that's fine. No references to these functions remain, even in comments.

This fixes the wrapping, hopefully it's still OK for me to mark as RTBC.

ianthomas_uk’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Setting to needs work, as this is not suitable for commit during Szeged and it's a pretty safe bet that it will conflict with something before the end of the week.

I have spoken to webchick and she suggested that she would be available to review/commit this next Monday, 31st March. There's little point in rerolling the patch until the weekend, but if there's a patch here on Monday that applies then I'll review it.

grom358’s picture

Assigned: Unassigned » grom358
grom358’s picture

Status: Needs work » Needs review
StatusFileSize
new77.41 KB

Rerolled

ianthomas_uk’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Core Review Bonus, -Needs reroll

That's a good reroll. The main changes were done correctly and due to

https://github.com/drupal/drupal/commit/dc15bf2eb231238b601d692da5f59d1b...
https://github.com/drupal/drupal/commit/bead76ad5b8c9e23caf2e5efea2bee01...
https://github.com/drupal/drupal/commit/13242b5af695a0f2aa386ded894a5bc0...

The other changes are just context, except:

+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
@@ -305,10 +306,10 @@ function testDrupalRenderSorting() {
+    // Pass $elements through \Drupal\Core\Render\Element::children() and
+    // ensure it remains sorted in the correct order. drupal_render() will
+    // return an empty string if used on the same array in the same request.
+    $children = Element::children($elements);

It looks like the script is wrapping comments at 79 characters rather than 80, but the docblock is still easily readable so I'm not going to set needs work for that.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks! Changes are covered in https://drupal.org/node/2173683.

  • Commit 40f818b on 8.x by webchick:
    Issue #2221755 by grom358, ianthomas_uk: Remove uses of deprecated...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.