Skip to content

Instantly share code, notes, and snippets.

@kjohnson
Last active June 7, 2016 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjohnson/08145d9d267b55e27983 to your computer and use it in GitHub Desktop.
Save kjohnson/08145d9d267b55e27983 to your computer and use it in GitHub Desktop.
<?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
}
@fatcatappsdev
Copy link

Typo'd $settigns a couple times

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment