This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
phplee
Im building a component that generates a form. i want to be able to set the defaults values of form fields from user data. Its similar to form builder so i want to be able to enter {{ user.firstname }} for example in the default field value in the backend and my component sets the default value in the form input. Basically turning user.firstname into $default = $user->firstname. I'm not sure how to parse the dynamic twig variable into an object in my component.
Any help would be great.
phplee
Just an update for anyone interested. i converted the object to an array.
$user = $user->toArray();
$newValue = $user[$value];
Last updated
1-2 of 2