Tuesday, 15 April 2014

php - How to customize WordPress' gravity forms -


How can I customize the form before presentation? Actually what I want to do, change the label, add the default value to the input box, pre-select the drop-down, and pre-selection. I added a hook to handle the pre-rendered event, unfortunately it was not working.

The label below is for label optimization only. What do I expect with this code is that the input box label should be "Test Label" after rendering the form.

Can anyone tell me what is wrong with my code?

  / * I code this template / function Php * / / * gravity forms are placed in / add_filter ('Gform_pre_render', 'customize_form'); Function customize_form ($ form) {if ($ form ['id'] = 6) $ form return; Foreign currency ($ form ['fields'] as & amp; $ field) {if ($ field ['id'] == 10) {var_dump ($ field ['inputs']); $ Field ['input'] [0] ['label'] = "test label"; }} Returned the $ form; }  


No comments:

Post a Comment