Remove usage of drupal_set_title() in all tests and documentation, meaning:

Comments

ianthomas_uk’s picture

Issue summary: View changes

Removed core/modules/system/system.api.php as it's installation related, so better suited to #2192649: Remove drupal_set_title() from installation and update process

ianthomas_uk’s picture

Issue summary: View changes
ianthomas_uk’s picture

ianthomas_uk’s picture

Issue summary: View changes
sandipmkhairnar’s picture

StatusFileSize
new2.14 KB

First drafted patch.

wim leers’s picture

Status: Active » Needs work
  1. +++ b/core/lib/Drupal/Core/Page/DefaultHtmlFragmentRenderer.php
    @@ -77,8 +77,6 @@ public function preparePage(HtmlPage $page, &$page_array) {
    -      // drupal_set_title() already ensured security, so not letting the
    -      // title pass through would cause double escaping.
           $page->setTitle($title, PASS_THROUGH);
    

    Why would you remove this comment? It's still relevant & useful.

  2. +++ b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
    @@ -61,14 +61,8 @@ function tearDown() {
    -    // drupal_set_title's $filter is Title::CHECK_PLAIN by default, so the title should be
    -    // returned with check_plain().
    -    drupal_set_title($title, Title::CHECK_PLAIN);
    -    $this->assertTrue(strpos(drupal_get_title(), '<em>') === FALSE, 'Tags in title converted to entities when $output is Title::CHECK_PLAIN.');
    -    // drupal_set_title's $filter is passed as PASS_THROUGH, so the title should be
    -    // returned with HTML.
    -    drupal_set_title($title, PASS_THROUGH);
    -    $this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, 'Tags in title are not converted to entities when $output is PASS_THROUGH.');
    +    $this->assertTrue(strpos(Title::CHECK_PLAIN, '<em>') === FALSE, 'Tags in title converted to entities when $output is Title::CHECK_PLAIN.');
    +    $this->assertTrue(strpos(PASS_THROUGH, '<em>') !== FALSE, 'Tags in title are not converted to entities when $output is PASS_THROUGH.');
    

    I'm afraid these changes are completely nonsensical.

    You're no longer testing what the results of a function call are, you're simply checking what the values of a few variables is.

ianthomas_uk’s picture

Status: Needs work » Closed (duplicate)

Everything here is covered by other issues, including the new issue #2209595: Remove drupal_set_title(), drupal_get_title() and associated tests