elvina Posted July 23 Share Posted July 23 Hi, I have a repeater on a page. It is a committe with different sections, so I have each section as a repeating block containing another repeater with the members. eg. Block: title="Presidency", contains Ms J. Smith - President, Mr J. Brown - Treasurer etc Block: title="Executive Committee" contains other members. This all works fine, but when I edit in the front end, the Block editor comes up with my repeater field but says "editing block 21245454354" and opens saying "editing page 21245454354". I can see these are the page titles in the admin, but is there a way to have these pages named as the title of that block? thanks Link to comment Share on other sites More sharing options...
poljpocket Posted July 24 Share Posted July 24 That is your "block editor"? Do you mean PageFrontEdit from the core? Link to comment Share on other sites More sharing options...
elvina Posted July 24 Author Share Posted July 24 OK, I had to fiddle with getting the right hooks. As the page is made before the title field is entered in the repeater. So this renames the repeater page with the field title and the year field of the original page holding the repeater. $wire->addHookBefore('Pages::save', function(HookEvent $event) { $page = $event->arguments(0); if($page->template->name == 'repeater_committee_section') { $title = $page->field_title; $year=date('Y', $page->getForpage()->starts); if (!empty($title)) { $page->name = $page->field_title . "-" . $year; } } }); 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