August Posted March 12, 2024 Share Posted March 12, 2024 Hello, I'm looking for a way to append a title beside the headline of a page which is beeing edit. It's about ease of use, at first glance. To figure out, first I tried something like that: (file "_content-head.php" of AdminThemeUikit (just Testing and remove)); if($headline !== '' && !$adminTheme->isModal) { # Test-Line: get current page-id (edit) $p = $this->pages->get($this->input->get->id); # Test-Line: check (type=text) page_field isn't empty $appendix = !$p->page_field == '' ? "($p->page_field)" : ''; echo "<h1 id='pw-content-title' class='uk-margin-remove-top'>$headline . " ($appendix)</h1>"; Then, I tried a Hook, but it alters the page->title and this doesnt fit my need here. wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments('page'); if ($page->template != 'my_template') return; $page->of(false); $page->title = "\$page->title|\$headline - " . $page->page_field->title; $event->return = $page; }); I read about: Process::headline(), but can't figure out. Does Someone has an Suggestion, how I can extend/append the existing title (page edit) with tiny Text, just render? Thanks in Advance 1 Link to comment Share on other sites More sharing options...
dotnetic Posted March 13, 2024 Share Posted March 13, 2024 The method you are looking for is headline. You could hook ProcessPageEdit:execute in a file like site/ready.php like described here. Adapt the template name in the following code to your needs: $wire->addHookAfter('ProcessPageEdit::execute', function (HookEvent $event) { $pageEdit = $event->object; $page = $pageEdit->getPage(); if ($page->template != 'shop') { return; // return early } $this->wire('processHeadline', 'My new headline'); // or modify the existing headline // $headline = $this->wire('processHeadline'); // $this->wire('processHeadline', $headline . " - " . date('d.m.Y', $page->created)); }); For easier finding and helping others in the future, I made a support post out of this: 1 Link to comment Share on other sites More sharing options...
August Posted March 13, 2024 Author Share Posted March 13, 2024 Hello @dotnetic, it fits exactly. ? It's what I was looking for, just great, thank you very much for that! I found this post in the morning: How to remove breadcrumbs, modify headline? and would most probably have failed on it .. It feels good while you grow with a project and learn a lot of basic things and have the support of the great processwire- community. And thats motivating too. This is not a given, so thank you all! 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now