Jump to content

Livia P

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Livia P

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks @PWaddict! I have tried your syntax, too, but it still gives me the ‘Missing required field’ for the title when I save it first. ☹️ Can it be some setting I have differently? Or the fact it’s a multilingual page? Just guessing here. I mean, no big deal, I can work around this from the front-end, I just hate that I don’t understand what’s causing this.
  2. Thanks much, @kp52 and @dragan! To rendering on the front-end: that part is clear. However, I would like to have this behaviour upon creation of new pages in the Admin, if possible.
  3. Hello there, I am fairly new to PW and PHP (spoiler alert: totally new to hooks). I am trying to add a few custom functions to the Admin for certain "patterns" that will be repeating throughout the site I am building. One example of such a pattern is this: I have a 'product' template with a Page Reference field for single page input, 'design'. Once selected, I need to set the title of the product page to the title of this design. I have added the below to the ready.php (pieced together based on whatever I have read up here, feel free to laugh 🙂). It does the job, but only in 2 saves, as upon the first one it throws a 'Missing required value'-error for the title, although the values do get visibly filled in. Can someone help me out with where I am going wrong here or how else to approach solving this? $this->pages->addHookBefore('saveReady', null, 'buildTitle'); function buildTitle($event) { $page = $event->arguments(0); if($page->template != 'product') return; if($page->template = 'product') { $p = $page->design; $page->title = $p->title; } } Thanks much.
  • Create New...