This is part of #2046881: [meta] Avoid "early rendered" strings where beneficial to do so, build structured data to pass to drupal_render() once instead.

Line 147 of authorize.php:

$output = drupal_render($elements);

This $output is only used in the following:

print theme('maintenance_page', array('content' => $output, 'show_messages' => $show_messages));

maintenance-page.html.twig does this:

{{ content }}

This means the initial render of $output is useless and we should be able to safely turn this:

      // We have a batch to process, show the filetransfer form.
      $elements = drupal_get_form('authorize_filetransfer_form');
      $output = drupal_render($elements);

into:

      // We have a batch to process, show the filetransfer form.
      $output = drupal_get_form('authorize_filetransfer_form');
Files: 
CommentFileSizeAuthor
#12 2060401-12.patch647 bytesRisse
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 77,702 pass(es). View
#8 remove_render_authorize-2060401-8.patch575 bytesianthomas_uk
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch remove_render_authorize-2060401-8.patch. Unable to apply patch. See the log in the details link for more information. View

Comments

thedavidmeister’s picture

Issue tags: +Novice, +Needs manual testing
StephaneQ’s picture

Status: Active » Needs review
FileSize
559 bytes
FAILED: [[SimpleTest]]: [MySQL] 57,832 pass(es), 3 fail(s), and 0 exception(s). View
thedavidmeister’s picture

Issue tags: -Novice

That patch seems fine to me. Just need someone to verify the markup is unaltered.

Status: Needs review » Needs work

The last submitted patch, remove_render_authorize-2060401-2.patch, failed testing.

thedavidmeister’s picture

thedavidmeister’s picture

thedavidmeister’s picture

Issue summary: View changes
Status: Postponed » Needs work

no longer postponed.

ianthomas_uk’s picture

Status: Needs work » Needs review
FileSize
575 bytes
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch remove_render_authorize-2060401-8.patch. Unable to apply patch. See the log in the details link for more information. View

I'm not really sure how to test this, but here's a reroll of #2 which also replaces drupal_get_form because it's a deprecated function.

There are a couple of drupal_renders higher up the page, but their output is being concatanated. Is it possible to stop those from being early rendered too?

Jalandhar’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: remove_render_authorize-2060401-8.patch, failed testing.

Risse’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll +Amsterdam2014
FileSize
647 bytes
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 77,702 pass(es). View

Reroll.

andypost’s picture

Status: Needs review » Closed (cannot reproduce)

already fixed

    elseif (!$batch = batch_get()) {
      // We have a batch to process, show the filetransfer form.
      $content = \Drupal::formBuilder()->getForm('Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm');
    }