Fix meta title property#11368
Conversation
| $method = 'get' . $this->string->upperCaseWords($name, '_', ''); | ||
| if($name === 'title') { | ||
| if (!$content) { | ||
| $content = $this->escaper->escapeHtml($this->pageConfig->$method()->get()); |
There was a problem hiding this comment.
Why do we need escapeHtml here? Seems inconsistent with other meta data getters.
Maybe just add __toString to \Magento\Framework\View\Page\Title?
There was a problem hiding this comment.
Becouse in the same file at line 109 we have:
return '<title>' . $this->escaper->escapeHtml($this->pageConfig->getTitle()->get()) . '</title>' . "\n";
so i reproduced the same behaviour
There was a problem hiding this comment.
I think the original reason for that is that if someone enter some html inside the title is has to be escaped to not break the html
|
tests are failing, i'll try to fix them |
|
@magento-engcom-team any news? |
|
Hi @slackerzz, changes looks good to me now but process has changed a bit since the time this PR was created. We need to deliver any contribution into |
|
Hi @orlangur, i'll create a new PR since changing the target branch generates a lot of conflicts |
|
Hi @slackerzz. Thank you for your contribution. |
Description
If, inside a controller you try to set metadata title with:
you will get an error on frontend:
Recoverable Error: Object of class Magento\Framework\View\Page\Title could not be converted to string...
becouse
processMetadataContentwill return an istance ofMagento\Framework\View\Page\Titleinstead of a string.Fixed Issues (if relevant)
Manual testing scenarios
Scenario 1
executefunction add:Scenario 2
executefunction add:Contribution checklist