didhavn Posted March 9, 2016 Posted March 9, 2016 Hey All. I am trying to change the label of a field after a certain page is saved.This field is not part of the page that is saved but the label should be updated with the page name. $pages->addHookAfter('saved', function($event) { $page = $event->arguments[0]; if($page->template->name == 'service-type') { $cid = $page->id; $this->message($cid); /* find field servicetype_rangeslider_$cid and set label */ // how to access $fields?? } }); I have this hook in my /site/ready.php. Now my remaining problem is, how to access $fields array or in general, how to get the field? I am thankful for every hint, thanks!!
kongondo Posted March 9, 2016 Posted March 9, 2016 (edited) In a hurry, short answer: http://processwire.com/api/variables/fields/ Edited March 9, 2016 by kongondo
didhavn Posted March 9, 2016 Author Posted March 9, 2016 I know how to access fields in general but the $fields variable is not defined inside the hook. And I did not manage to get it e.g. via the $event variable.
kongondo Posted March 9, 2016 Posted March 9, 2016 What? I get nothing for my troubles? ...Glad you got it sorted... 1
didhavn Posted March 9, 2016 Author Posted March 9, 2016 Of course a BIG SPECIAL THANK to the fastes replying user in this forum..... kongondo !! 1
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