FluentForms has the following PHP api functions so you can easily access from fields, entries and other data.
Accessing Form #
<?php
$formApi = fluentFormApi('forms');
/**
* Find a form by form ID
* @param $entryId (int)
* @return null | Form Object
*/
$formObj = $formApi->find($formId = 1)
/**
* Get the paginated list of forms.
* You can search form forms with multiple attributes and get matched form objects in return with labels.
* @param $atts (array), $withFields (boolean)
* @return: array
*/
$atts = [
'search' => 'formName',
'status' => 'all',
'sort_column' => 'id',
'sort_by' => 'DESC',
'per_page' => 10,
'page' => 1
];
$forms = $formApi->forms($atts, $withFields = false)
Accessing Form Properties #
<?php
/**
* Get the form instance first
*/
$formApi = fluentFormApi('forms')->form($formId = 1);
/**
* Get inputs data by form ID
* You can get input fields with admin label or raw data.
* @parms $with (array)
* @return array
*/
$formApi->inputs($with = ['admin_label', 'raw']);
/**
* Get Form Input labels
* @return array
*/
$formApi->labels();
/**
* Get Form Input Fields Data
* @return array
*/
$formApi->fields();
/**
* Get Form Settings
* @return array
*/
$formApi->settings();
/**
* Get Form Email Notification Settings
* @return array
*/
$formApi->emailNotifications();
/**
* Get Form Meta data by meta key, for example : '_custom_form_css' , '_custom_form_js'
* You can set a default value to return if no data found
* $param $metaKeyName (string), $default (boolean)
* @return array
*/
$formApi->meta($metaKeyName, $default = false);
/**
* Get Form Email Notification Settings
* @return array
*/
$formApi->emailNotifications();
/**
* Check the status of the form it passed all conditions and is renderable.
* @return array
*/
$formApi->renderable();
/**
* Get the conversion rate of the form.
* @return int
*/
$formApi->conversionRate();
/**
* Get the conversion rate of the form.
* @return int
*/
$formApi->submissionCount();
/**
* Get the view count of the form.
* @return int
*/
$formApi->viewCount();
/**
* Get the unread status count of the form.
* @return int
*/
$formApi->unreadCount();
/**
* Get any form property value
* You can directly access any form properly for example form title
* @return mixed | false
*/
$formApi->title;
Accessing Form Entries #
<?php
/**
* Get the form entry instance first
* @param $formId (int)
* @return null or Entry Object Instance
*/
$formApi = fluentFormApi('forms')->entryInstance($formId = 1);
/**
* Get a single entry of a form
* You can get a single form entry by entry Id
* @params $entryId (int), $includeFormats (boolean)
* @return null or Entry Object
*/
$entry = $formApi->entry($entryId = 1, $includeFormats = false);
/**
* Get a list of entries of a form
* You can paginated form entries by form Id
* @params $atts (array), $includeFormats (boolean)
* @return array
*/
$formApi = fluentFormApi('forms')->entryInstance($formId = 1);
$atts = [
'per_page' => 10,
'page' => 1,
'search' => '',
'sort_by' => 'DESC',
'entry_type' => 'all'
];
$entries = $formApi->entries($atts , $includeFormats = false);
/**
* Get the Entry Visual Data Report page data
* params $status (array)
* @return array
*/
$formApi = fluentFormApi('forms')->entryInstance($formId = 1);
$report = $formApi->report( $status = ['read']);