Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Mar 2014 at 18:18 UTC
Updated:
30 Dec 2014 at 15:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ianthomas_ukHere is my removal patch, along with a version for the test bot that includes the latest patches from all the other uncommitted sub-issues of the meta.
The patch:
- Moves PASS_THROUGH to Component\Utility\Title::PASS_THROUGH and updates all uses.
- Removes drupal_set_title and drupal_get_title.
- Removes calls to drupal_get_titles where it is one of a variety of places to get the title from, on the assumption that the title will always have been moved to one of the alternative locations in an earlier sub-issue.
- Defaults $variables['title'] to an empty string in template_preprocess_page to ensure it is always set (this may not be necessary).
- Removes check_plain/xss tests of drupal_set_title. We need to ensure these have been replaced, maybe by phpunit tests of \Drupal\Core\Page\HtmlFragment.
- Leaves one remaining comment mentioning drupal_set_title() in \Drupal\system\Tests\System\PageTitleTest as I don't understand what the comment means.
Comment #2
dawehnerDo we really want to drop it?
I wonder whether we can/should add a default 'title' variable into system_element_info instead
Comment #3
ianthomas_ukI assume you looked at the -combined patch, authorize_run_operation was changed in #2192653-7: Remove drupal_set_title from authorize.php.
Yes, I agree we should add a default title variable (of empty string) to system_element_info. We should also move the line you quoted higher up the function, to just below
Comment #6
ianthomas_ukComment #7
ianthomas_ukRevised patch addressing #2/#3 and fixing the failing test (the other failure is random and unrelated)
Comment #9
wim leers#2192649: Remove drupal_set_title() from installation and update process landed! This is the last one :)
It seems the patch here includes #2192649 though?
Comment #10
ianthomas_uk@Wim Leers, the patch depends on #2192649: Remove drupal_set_title() from installation and update process, so I uploaded both versions.
I'm looking at the failing test (minor), but I'd appreciate reviews and help with the two points I raised earlier:
- Removes check_plain/xss tests of drupal_set_title. We need to ensure these have been replaced, maybe by phpunit tests of \Drupal\Core\Page\HtmlFragment.
- Leaves one remaining comment mentioning drupal_set_title() in \Drupal\system\Tests\System\PageTitleTest as I don't understand what the comment means.
Comment #11
wim leers7: drupal-2209595-remove-drupal_set_title-7-combined.patch queued for re-testing.
Comment #12
wim leersAha! Re-testing in that case now that that is committed, I will review/help ASAP :)
Comment #14
ianthomas_ukIt's the -do-not-test.patch you need to look at, which should pass except for one issue that I'm looking into. I'll upload a new patch when I've fixed that.
Comment #15
wim leersOh, ok — sorry!
Comment #16
ianthomas_ukHere is my new patch, note the interdiff is to patch #1 as I've undone the change made in #7.
Previously it made up a $head_title if there was nothing in drupal_get_title(). There is now never anything in drupal_get_title(), which means the title was effectively untested. I've therefore updated the test to pass a test title as part of the render array.
Comment #17
ianthomas_uk#title is not escaped, so we don't need to test the escaping. We already have some tests for this in Drupal\system\Tests\Common\RenderElementTypesTest, so we need any more?
Comment #18
sunThis looks good to me, borderline RTBC. Two considerations:
Drupal\Core\Utility\Titlejust contains constants; that should not exist — let's create a follow-up issue to eliminate that utility class and move those constants to a proper home. It would actually be best if those constants would not exist in the first place; now that we have class methods, we can simply have separategetRawTitle(),getPlainTitle(),getXssSafeTitle()methods.Comment #19
ianthomas_uk#18.1 Sounds reasonable, I have opened #2214525: Remove unused Drupal\Core\Utility\Title. In the meantime, this at least brings some consistency to the constants that we do have.
#18.2 Yes, that happens about 50 lines into template_preprocess_html() in core/includes/theme.inc. I can't find a page without a title, but it does work correctly if I force it to fall through to the default.
Comment #20
wim leersIf #18.2 is still working, can't we simply add a super short test for it? Probably in
RenderElementTypesTest, where similar things are already being tested.Otherwise: if sun is happy, then I am also :)
Comment #21
sunThanks, and sorry for my confusion; indeed, that default page title is handled in the template preprocess function - I forgot about that. And I'm fairly sure that we have tests for that.
Comment #22
ianthomas_ukThis shuffles RenderElementTypesTest around a little bit so we first test without a page title, and then with one.
I've also removed the comment I was unsure of earlier. I traced it to #461938-13: Core should consistently filter_xss_admin() on $site_slogan and check_plain $site_name and I think it's related to the that has been put at the start of the test string. In any case, we should be checking for the text as the full title tag, so I've included that in the assertion and clarified the messages.
Setting to critical as this will close a beta blocker.
Comment #24
ianthomas_ukI swear that passed locally before...
We can't add to that test because we're testing using the site name rather than the page title. The is because the title is output as the heading on the page.
Comment #25
wim leersSorry, nitpick review only. I'll leave the actual review to sun, who knows the installer much better. Setting to NW so that the nitpicks are definitely out of the way, so that sun can hopefully RTBC.
Missing period.
Missing period.
Comment #26
ianthomas_ukAdded those full stops, no other changes.
Comment #27
sunThanks!
Comment #29
ianthomas_uk26: drupal-2209595-remove-drupal_set_title-26.patch queued for re-testing.
Drupal\toolbar\Tests\ToolbarAdminMenuTest->testCacheClearByCacheTag() triggered a fatal error.
Comment #30
wim leersThis was RTBC at #27, and as per #29 it was only demoted to NW due to a random testbot fail. Back to RTBC!
Comment #31
webchickAwesome work, all! https://drupal.org/node/2067859 covers the change in a change notice already.
Committed and pushed to 8.x. Thanks!
Comment #33
chx commented