Last active
June 7, 2016 21:28
-
-
Save kjohnson/08145d9d267b55e27983 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Create a Field | |
*/ | |
$field = Ninja_Forms()->form( 1 )->field()->get(); | |
$field->update_settings( 'type', 'textbox' )->save(); | |
/* | |
* Create a Field with an array of Settings | |
*/ | |
$settings = array( | |
'type' => 'textbox', | |
'label' => 'name', | |
'label_post' => 'inside', | |
'required' => 1 | |
); | |
$field = Ninja_Forms()->form( 1 )->field()->get(); | |
$field->update_settings( $settigns )->save(); | |
/* | |
* Update a Field | |
*/ | |
$field = Ninja_Forms()->form()->field( 1 )->get(); | |
$field->update_settings( 'type', 'textbox' )->save(); | |
/* | |
* Update a Field with an array of Settings | |
*/ | |
$settings = array( | |
'type' => 'textbox', | |
'label' => 'name', | |
'label_post' => 'inside', | |
'required' => 1 | |
); | |
$field = Ninja_Forms()->form()->field( 1 )->get(); | |
$field->update_settings( $settigns )->save(); | |
/* | |
* Loop through Fields | |
*/ | |
$fields = Ninja_Forms()->form( 1 )->get_fields(); | |
foreach( $fields as $field ){ | |
// Do Stuff Here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Typo'd $settigns a couple times