How I can change page header title from controller in admin page?
In the picture I want to change Dashboard to something else. I tried below code in execute method of the controller
$pageFactory = $this->resultPageFactory->create();
$pageFactory->getConfig()->getTitle()->prepend(__("Your Title"));
It is adding the title to the browsers tab but not changing the header title in the main page. How to change main page title?
Below is the html shown on inspecting in the browser.
<div class="page-header-hgroup col-l-8 col-m-6">
<div class="page-title-wrapper">
<h1 class="page-title">Dashboard</h1>
</div>
</div>
I have also tried below code
$this->_view->getLayout()->getBlock('page.main.title')->setPageTitle('Something else');
$this->_view->renderLayout();
It says Error: Call to a member function setPageTitle() on bool.