本文整理汇总了PHP中GFAPI::get_form方法的典型用法代码示例。如果您正苦于以下问题:PHP GFAPI::get_form方法的具体用法?PHP GFAPI::get_form怎么用?PHP GFAPI::get_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFAPI
的用法示例。
在下文中一共展示了GFAPI::get_form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_entries_assignees
/**
* Processes a status update for a specified assignee of the current step of the specified entry.
*
* @param $entry_id
* @param string $assignee_key
*/
function post_entries_assignees($entry_id, $assignee_key = null)
{
global $HTTP_RAW_POST_DATA;
$capability = apply_filters('gravityflow_web_api_capability_post_entries_assignees', 'gravityflow_create_steps');
$this->authorize($capability);
if (empty($assignee_key)) {
$this->end(400, 'Bad request');
}
$entry = GFAPI::get_entry($entry_id);
if (empty($entry)) {
$this->end(404, 'Entry not found');
}
$form_id = absint($entry['form_id']);
$api = new Gravity_Flow_API($form_id);
$step = $api->get_current_step($entry);
$assignee = new Gravity_Flow_Assignee($assignee_key, $step);
if (!isset($HTTP_RAW_POST_DATA)) {
$HTTP_RAW_POST_DATA = file_get_contents('php://input');
}
$data = json_decode($HTTP_RAW_POST_DATA, true);
$new_status = $data['status'];
$form = GFAPI::get_form($form_id);
$step->process_assignee_status($assignee, $new_status, $form);
$api->process_workflow($entry_id);
$response = 'Status updated successfully';
$this->end(200, $response);
}
示例2: initialise_form_edit
public static function initialise_form_edit()
{
/*
* If we aren't editing our form, don't do anything
*/
if (empty($_GET['action']) || empty($_GET['lid']) || !is_user_logged_in()) {
return false;
}
$lid = isset($_GET['lid']) ? (int) $_GET['lid'] : 0;
self::$lead = $lead = GFAPI::get_entry($lid);
self::$form = $form = GFAPI::get_form(self::$lead['form_id']);
if (!self::check_user_permission(self::$lead)) {
return false;
}
self::$allowed_edit = true;
if (!class_exists('GFFormDisplay')) {
require_once GFCommon::get_base_path() . "/form_display.php";
}
$field_values = RGForms::post("gform_field_values");
/*
* Include appropriate css/javascript here...
*/
GFFormDisplay::enqueue_form_scripts($form, false);
GFFormDisplay::add_init_script($form["id"], "conditional_logic", GFFormDisplay::ON_PAGE_RENDER, self::get_conditional_logic($form, $field_values));
GFFormDisplay::add_init_script($form["id"], "pricing", GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_pricing_init_script($form));
$chosen_script = GFFormDisplay::get_chosen_init_script($form);
GFFormDisplay::add_init_script($form["id"], "chosen", GFFormDisplay::ON_PAGE_RENDER, $chosen_script);
GFFormDisplay::add_init_script($form["id"], "chosen", GFFormDisplay::ON_CONDITIONAL_LOGIC, $chosen_script);
GFFormDisplay::add_init_script($form['id'], 'input_mask', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_input_mask_init_script($form));
GFFormDisplay::add_init_script($form['id'], 'calculation', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_calculations_init_script($form));
GFFormDisplay::add_init_script($form['id'], 'currency_format', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_currency_format_init_script($form));
return true;
}
示例3: aura_get_master_aura_form_details
function aura_get_master_aura_form_details($form, $ajax_enabled, $field_values)
{
// Get details from master form.
$ar_form = GFAPI::get_form(1);
$au_search_criteria = array('status' => array('active', 'trash'));
$ar_entries = GFAPI::get_entries(1, $au_search_criteria);
$body_part = array();
// To hold description associated with bodypart/color.
$pos_color = array();
$neg_color = array();
$bp = array();
// Pull details from aura details form to display in this form.
// Index each entry by 'body part'
foreach ($ar_entries as $entry) {
if ($entry['1'] == '') {
continue;
} else {
$idx = $entry['1'];
$bp[] = array('text' => $entry['1'], 'value' => $entry['1']);
if ($entry['2'] != '') {
$body_part[$idx]['pos_color'][$entry['2']] = $entry['4'];
// Set pos colour value to description
$needle = array('text' => $entry['2'], 'value' => $entry['2']);
if (!in_array($needle, $pos_color)) {
$pos_color[] = $needle;
}
}
if ($entry['3'] != '') {
$body_part[$idx]['neg_color'][$entry['3']] = $entry['5'];
$needle = array('text' => $entry['3'], 'value' => $entry['3']);
if (!in_array($needle, $neg_color)) {
$neg_color[] = $needle;
}
}
}
}
// To display description using JS
$json_bp = json_encode($body_part);
/*
$html =
'<input type="hidden" name="aura_body_part"' .
'id="aura_body_part_id"' .
'value=' . $json_bp .
' />' ;
*/
// HACK/REVISIT: Creating JS var safe?
$html = '<script type="text/javascript"> var g_aura_body_part=' . $json_bp . '</script>';
echo $html;
$form['fields'][5]['choices'] = $bp;
$form['fields'][6]['choices'] = $pos_color;
$form['fields'][8]['choices'] = $neg_color;
// Default display
$form['fields'][5]['placeholder'] = 'Pick choice from list below';
$form['fields'][6]['placeholder'] = 'Pick choice from list below';
$form['fields'][8]['placeholder'] = 'Pick choice from list below';
// $form['fields'][7]['choices'] = $pos_color_descr;
// $form['fields'][9]['choices'] = $neg_color_descr;
return $form;
}
示例4: get_this_field_value_entry_list
public function get_this_field_value_entry_list($value, $form_id, $field_id, $entry)
{
$form = GFAPI::get_form($form_id);
$field = GFFormsmodel::get_field($form, $field_id);
if ($this->is_this_field_type($field)) {
$value = $this->get_value_entry_list($value, $form_id, $field_id, $entry);
}
return $value;
}
示例5: feed_settings_fields
function feed_settings_fields()
{
if (is_numeric($_GET['id'])) {
$feed_form_id = $_GET['id'];
$form = GFAPI::get_form($feed_form_id);
}
$args = array('field_types' => array(), 'input_types' => array('text', 'name', 'email'), 'callback' => false);
$fields = GFAddOn::get_form_fields_as_choices($form, $args);
return array(array('title' => 'Postmatic', 'fields' => array(array('name' => 'feed_name', 'label' => 'Feed Name', 'type' => 'text'), array('name' => 'first_name', 'label' => 'First Name Field', 'type' => 'select', 'choices' => $fields), array('name' => 'last_name', 'label' => 'Last Name Field', 'type' => 'select', 'choices' => $fields), array('name' => 'email', 'label' => 'Email Field', 'type' => 'select', 'choices' => $fields, 'required' => true), array('name' => 'condition', 'tooltip' => "Configure the event that riggers the user to be subscribed to your Postmatic feed.", 'label' => 'Condition', 'type' => 'feed_condition', 'checkbox_label' => 'Enable condition for this subscription', 'instructions' => 'Subscribe this user if'))));
}
示例6: wpfg_lookup_gravityform
function wpfg_lookup_gravityform($form_id)
{
if (!class_exists('GFAPI')) {
return false;
}
$form = GFAPI::get_form($form_id);
if ($form['title']) {
return $form['title'];
}
return false;
}
示例7: get_forms
/**
* Returns all the form objects
*
* @since 1.8.11.5
* @access public
* @static
*
* @param bool $active
* @param bool $trash
*
* @return mixed The array of Forms
*/
public static function get_forms($active = true, $trash = false)
{
$form_ids = GFFormsModel::get_form_ids($active, $trash);
if (empty($form_ids)) {
return array();
}
$forms = array();
foreach ($form_ids as $form_id) {
$forms[] = GFAPI::get_form($form_id);
}
return $forms;
}
示例8: getFormInitScripts
function getFormInitScripts()
{
if (intval(get_query_var('getFormInitScripts')) != '') {
require_once GFCommon::get_base_path() . '/form_display.php';
$form = GFAPI::get_form(get_query_var('getFormInitScripts'));
$field_values = array();
// the array of parameter names and values if any fields are being populated
GFFormDisplay::register_form_init_scripts($form, $field_values);
$form_string = GFFormDisplay::get_form_init_scripts($form);
echo strip_tags($form_string);
exit;
}
}
示例9: get_form
/**
* Returns the form object for a given Form ID.
*
* @access public
* @param mixed $form_id
* @return mixed False: no form ID specified or Gravity Forms isn't active. Array: Form returned from Gravity Forms
*/
public static function get_form($form_id)
{
if (empty($form_id)) {
return false;
}
if (class_exists('GFAPI')) {
return GFAPI::get_form($form_id);
}
if (class_exists('RGFormsModel')) {
return RGFormsModel::get_form($form_id);
}
return false;
}
示例10: get_form
/**
* Returns the form object for a given Form ID.
*
* @access public
* @param mixed $form_id
* @return mixed False: no form ID specified or Gravity Forms isn't active. Array: Form returned from Gravity Forms
*/
public static function get_form($form_id)
{
if (empty($form_id)) {
return false;
}
// Only get_form_meta is cached. ::facepalm::
if (class_exists('RGFormsModel')) {
return GFFormsModel::get_form_meta($form_id);
}
if (class_exists('GFAPI')) {
return GFAPI::get_form($form_id);
}
return false;
}
示例11: load_form_data
public function load_form_data($lead, $form_id = '')
{
$form_id = is_numeric($form_id) ? $form_id : (isset($lead['form_id']) ? $lead['form_id'] : $lead['id']);
// No form id
if (!$form_id) {
return false;
}
$form = \GFAPI::get_form($form_id);
// Invalid form ID
if (!$form) {
return false;
}
$file_fields = array();
$url_field = array();
$values = array();
foreach ($form['fields'] as $field) {
if (isset($field["inputs"]) && is_array($field['inputs'])) {
foreach ($field['inputs'] as $input) {
// Extract best label
$key = $input['label'] ? $input['label'] : \GFCommon::get_label($field, (string) $input["id"]);
// Redundant formatting
$key = strtolower(str_replace(array(' '), array('_'), $key));
$value = isset($lead[(string) $input['id']]) ? $lead[(string) $input['id']] : "";
$values[$key] = htmlentities(stripslashes($value), ENT_QUOTES);
}
} elseif (!rgar($field, 'displayOnly')) {
// Extract best label
$key = isset($field['adminLabel']) && $field['adminLabel'] != "" ? $field['adminLabel'] : ($field['label'] ? $field['label'] : \GFCommon::get_label($field));
// More redundant formatting
$key = strtolower(str_replace(array(' '), array('_'), $key));
$value = isset($lead[$field['id']]) ? $lead[$field['id']] : "";
$values[$key] = htmlentities(stripslashes($value), ENT_QUOTES);
}
}
$values['logo'] = $this->logo ? $this->logo : $values['logo'];
// An image field being re-assign from post file data
try {
$this->assign($values);
} catch (Exception $e) {
$error = $e->getMessage();
}
if (!$this->product_id && isset($lead['source_url'])) {
// only needed if used in conjunction with woocommerce fulfillment
$this->product_id = url_to_postid($lead['source_url']);
}
return true;
}
示例12: save
/**
* Save function stores class data as Wordpress meta data
* @return boolean true on success and false on failure
*
*/
public function save()
{
throw new NotImplementedException();
if (!defined('WPINC') || !$this->_post_id || !class_exists('GFAPI')) {
return false;
}
$lead = GFAPI::get_entry($this->_post_id);
$form = GFAPI::get_form($lead['form_id']);
$values = array();
foreach ($form['fields'] as $field) {
$key = $field['adminLabel'] ? $field['adminLabel'] : strtolower($field['label']);
$value = $lead[$field['id']];
$values[$key] = $value;
}
$success = GFAPI::update_entry($this->_data, $this->_post_id);
return $success;
}
示例13: maybe_add_review_page
/**
* Get form object and insert review page, if necessary.
*
* @param int $form_id The ID of the Form
* @return mixed The form meta array or false
*/
public static function maybe_add_review_page($form_id)
{
$form = GFAPI::get_form($form_id);
/* Setup default review page parameters. */
$review_page = array('button_text' => __('Review Form', 'gravityforms'), 'content' => '', 'is_enabled' => false);
/* Prepare partial entry for review page. */
$partial_entry = GFFormsModel::create_lead($form);
/**
* A filter for setting up the review page
*
* @param array $review_page The review page parameters
* @param array $form The current form object
* @param array $partial_entry The partial entry for the form
*/
$review_page = gf_apply_filters('gform_review_page', $form['id'], $review_page, $form, $partial_entry);
if (rgar($review_page, 'is_enabled')) {
$form = self::insert_review_page($form, $review_page);
}
return $form;
}
示例14: rotary_form_field_column_selector_choices
function rotary_form_field_column_selector_choices($acf_field)
{
global $id;
// reset choices
$acf_field['choices'] = array();
$gf_form_id = get_field('field_gravity_form_id', $id);
if ($gf_form_id) {
$gf_form = GFAPI::get_form($gf_form_id);
if (is_array($gf_form)) {
foreach ($gf_form['fields'] as $gf_field) {
$acf_field['choices'][$gf_field->id] = $gf_field->label;
}
} else {
$error = '<div><p class="alert" style="font-weight:bold;color:red;text-align:center;">Sorry, I can\'t find form ' . $gf_form_id . '</p></div>';
echo $error;
}
// return the field
}
return $acf_field;
}
示例15: set_post_content
function set_post_content($entry, $form)
{
//getting post
$post = get_post($entry['post_id']);
$posta = $wp_query->post;
$postid = $post->ID;
//setting grid variables
$petition_form_contain = '"container"';
$petition_form_row = '"row"';
$petition_form_col_1 = '"col-md-1"';
$petition_form_col_4_off_1 = '"col-md-4 col-md-offset-1"';
$petition_form_col_5 = '"col-md-5"';
$petition_form_col_6_off_1 = '"col-md-6 col-md-offset-1"';
//other variables
$petition_form = '"petition-privacy"';
$petition_form_petf = '"petfsize"';
$quoteone = '"';
//setting up the petition form
$formid = 1;
$form_count = RGFormsModel::get_form_counts($formid);
$form_count_disp = $form_count['total'];
$form_id_step = $form_count_disp + 32;
$form_id = 2;
$form = GFAPI::get_form($form_id);
$form_add_new = GFAPI::add_form($form);
$form_id = $form_id_step;
$form = GFAPI::get_form($form_id);
$form['title'] = 'Petition Form ID' . ' ' . $form_id;
$result = GFAPI::update_form($form);
//changing post content
$post->post_content = "<div class={$petition_form_col_4_off_1}>[gravityform id ={$quoteone}{$form_id_step}{$quoteone}]</div><div class={$petition_form_contain}><div class={$petition_form_row}>\r\n<div class={$petition_form_col_6_off_1}><div class={$petition_form_petf}>" . rgar($entry, '4') . "</div></div><div class={$petition_form_col_5}></div></div></div>";
//updating post
wp_update_post($post);
//adding form ID
$post_id = $postid;
$meta_key = 'field_petition_form_id';
$meta_value = $form_id_step;
add_post_meta($post_id, $meta_key, $meta_value);
}