Skip to content

[Backport] Fix meta title property #16948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 21, 2018
Merged

[Backport] Fix meta title property #16948

merged 3 commits into from
Jul 21, 2018

Conversation

ronak2ram
Copy link
Member

Original Pull Request

#11368

Description

If, inside a controller you try to set metadata title with:

$resultPage->getConfig()->setMetadata('title', 'some meta title');

you will get an error on frontend:

Recoverable Error: Object of class Magento\Framework\View\Page\Title could not be converted to string...

becouse processMetadataContent will return an istance of Magento\Framework\View\Page\Title instead of a string.

Fixed Issues (if relevant)

  1. Unable to render page when 'meta title' page config param is set #2956: Unable to render page when 'meta title' page config param is set

Manual testing scenarios

Scenario 1

  1. Create a controller
  2. Inside the execute function add:
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle->set('my title');
$resultPage->getConfig()->setMetadata('title', 'metatitle');
return $resultPage;
  1. As result you will have in your page:
<title>my title</title>
<meta name="title" content="metatitle"/>

Scenario 2

  1. Create a controller
  2. Inside the execute function add:
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle->set('my title');
return $resultPage;
  1. As result you will have in your page:
<title>my title</title>
<meta name="title" content="my title"/>

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @aleron75, thank you for the review.
ENGCOM-2429 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

Hi @ronak2ram. Thank you for your contribution.
We will aim to release these changes as part of 2.1.15.
Please check the release notes for final confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants