Objects

Retrieving the Object Model

<?php
// Returns an Object Model for Object ID 1
Ninja_Forms()->form()->object( 1 )->get();
// Returns an Object Model for Object ID 1
Ninja_Forms()->form()->get_object( 1 );
// Returns an array of Object Models for Form ID 1
Ninja_Forms()->form( 1 )->get_objects();
// Returns an array of Object Models for Field ID 1
Ninja_Forms()->form()->field( 1 )->get_objects();
// Returns an array of Object Models for Action ID 1
Ninja_Forms()->form()->action( 1 )->get_objects();

view raw
gistfile1.txt
hosted with ❤ by GitHub

Interacting with the Object Model

<?php
// Get the ID for a Model
$id = $model->get_id();
// Get a single setting for a Model by key
$setting = $model->get_setting( 'key' );
// Get all settings for a model
$settings = $model->get_settings();
// Get extra data stored with a submission.
$more_data = $model->get_extra_value( 'more_data' );
// Update a single setting for a model and save
$model->update_setting( 'key', 'value' )->save();
// Update an array of settings for a mdoel and save
$model->update_settings( $settings )->save();
// Delete a model
$model->delete();
// Save changes to a model
$model->save();