本文整理汇总了PHP中RGFormsModel::get_forms方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_forms方法的具体用法?PHP RGFormsModel::get_forms怎么用?PHP RGFormsModel::get_forms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_forms方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crb_get_forms
/**
* Get all available gravity forms
*/
function crb_get_forms()
{
$forms = array();
if (!class_exists('RGFormsModel')) {
return;
}
$available_forms = RGFormsModel::get_forms(null, 'title');
foreach ($available_forms as $form) {
$forms[$form->id] = $form->title;
}
return $forms;
}
示例2: partners_sub_page_metaboxes
function partners_sub_page_metaboxes()
{
$prefix = '_partners_page_';
$options[0] = 'Please select...';
if (class_exists('RGFormsModel')) {
foreach (RGFormsModel::get_forms(null, 'title') as $form) {
$options[$form->id] = $form->title;
}
}
/**
* Initiate the metabox
*/
$cmb = new_cmb2_box(array('id' => 'partners_page_form_meta', 'title' => __('Partners Page Form', 'cmb2'), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'show_on' => array('key' => 'page-template', 'value' => 'templates/partners.php')));
// Regular text field
$cmb->add_field(array('name' => __('Pick a Form', 'cmb2'), 'id' => $prefix . 'form_dropdown', 'type' => 'select', 'options' => $options));
/**
* Initiate the metabox
*/
$cmb = new_cmb2_box(array('id' => 'partners_page_file_meta', 'title' => __('Partners Page File Downloads', 'cmb2'), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'show_on' => array('key' => 'page-template', 'value' => 'templates/partners.php')));
$group_field_id = $cmb->add_field(array('id' => 'partners_file_download_group', 'type' => 'group', 'options' => array('group_title' => __('File {#}', 'cmb2'), 'add_button' => __('Add Another File', 'cmb2'), 'remove_button' => __('Remove File', 'cmb2'), 'sortable' => true)));
// Id's for group's fields only need to be unique for the group. Prefix is not needed.
$cmb->add_group_field($group_field_id, array('name' => 'File Title', 'id' => 'title', 'type' => 'text'));
$cmb->add_group_field($group_field_id, array('name' => 'File Upload', 'id' => 'link', 'type' => 'file'));
$cmb->add_group_field($group_field_id, array('name' => 'File Image', 'id' => 'image', 'type' => 'file'));
}
示例3: run
public function run($arguments)
{
if (class_exists('RGFormsModel') && is_callable(array('RGFormsModel', 'get_forms'))) {
return RGFormsModel::get_forms();
}
return false;
}
示例4: render_field
/**
* render_field()
*
* Create the HTML interface for your field
*
* @param $field (array) the $field being rendered
*
* @type action
* @since 3.6
* @date 23/01/13
*
* @param $field (array) the $field being edited
* @return n/a
*/
function render_field($field)
{
$field = array_merge($this->defaults, $field);
$choices = array();
if (class_exists('RGFormsModel')) {
$forms = RGFormsModel::get_forms(1);
} else {
echo '<font style="color:red; font-weight:bold;">Warning: Gravity Forms is not installed or activated. This field does not function without Gravity Forms!</font>';
}
if (isset($forms)) {
foreach ($forms as $form) {
$choices[intval($form->id)] = ucfirst($form->title);
}
}
$field['choices'] = $choices;
$field['type'] = 'select';
$multiple = '';
if ($field['allow_multiple']) {
$multiple = 'multiple="multiple" data-multiple="1"';
echo '<input type="hidden" name="' . $field['name'] . '">';
}
?>
<select id="<?php
echo str_replace(array('[', ']'), array('-', ''), $field['name']);
?>
" name="<?php
echo $field['name'] . ($field['allow_multiple'] ? '[]' : '');
?>
" <?php
echo $multiple;
?>
>
<?php
if ($field['allow_null']) {
?>
<option value="">Select ...</option>
<?php
}
?>
<?php
foreach ($field['choices'] as $key => $value) {
?>
<option value="<?php
echo $key;
?>
" <?php
echo (is_array($field['value']) && in_array($key, $field['value']) or $field['value'] == $key) ? 'selected="selected"' : '';
?>
><?php
echo $value;
?>
</option>
<?php
}
?>
</select>
<?php
}
示例5: get_gravity_forms
public function get_gravity_forms()
{
$forms = RGFormsModel::get_forms(null, 'title');
$form_array = array();
foreach ($forms as $form) {
$form_array[$form->id] = $form->title;
}
return $form_array;
}
示例6: get_forms
function get_forms()
{
$forms = RGFormsModel::get_forms();
$options = array('' => '– Select a Form –');
foreach ($forms as $form) {
$options[$form->id] = $form->title;
}
return $options;
}
示例7: get_forms
/**
* Get all forms and return in a simple array for output.
*
* @since WP Job Manager - Contact Listing 1.0.0
*
* @return void
*/
public function get_forms()
{
$forms = array(0 => __('Please select a form', 'wp-job-manager-contact-listing'));
$_forms = RGFormsModel::get_forms(null, 'title');
if (!empty($_forms)) {
foreach ($_forms as $_form) {
$forms[$_form->id] = $_form->title;
}
}
return $forms;
}
示例8: render_field
function render_field($field)
{
/*
* Review the data of $field.
* This will show what data is available
*/
// vars
$field = array_merge($this->defaults, $field);
$choices = array();
$forms = RGFormsModel::get_forms(1);
if ($forms) {
foreach ($forms as $form) {
$choices[$form->id] = ucfirst($form->title);
}
}
// override field settings and render
$field['choices'] = $choices;
$field['type'] = 'select';
?>
<select name="<?php
echo $field['name'];
?>
" id="<?php
echo $field['name'];
?>
" <?php
if ($field['multiple']) {
echo 'multiple';
}
?>
>
<?php
foreach ($field['choices'] as $key => $value) {
$selected = '';
if ($field['value'] == $key) {
$selected = ' selected="selected"';
}
?>
<option value="<?php
echo $key;
?>
"<?php
echo $selected;
?>
><?php
echo $value;
?>
</option>
<?php
}
?>
</select>
<?php
}
示例9: initialize
function initialize()
{
$forms = RGFormsModel::get_forms(1, 'title');
$options = [];
$default = 0;
foreach ($forms as $form) {
if (!$default) {
$default = $form->id;
}
$options[$form->id] = $form->title;
}
$this->settings = ['form_id' => ['#title' => 'Gravity form ID', '#type' => 'select', '#default_value' => $default, '#description' => 'The gravity form ID to be printed in the dropdown', '#to_js_settings' => false, '#options' => $options], 'dropdown' => ['#title' => 'Display as dropdown?', '#type' => 'checkbox', '#description' => 'Display as dropdown?', '#return_value' => '1', '#label_above' => true, '#replace_title' => 'Yes', '#default_value' => false]];
}
示例10: cspv4_get_gravityforms_forms
function cspv4_get_gravityforms_forms()
{
if (class_exists('RGFormsModel')) {
$forms = array();
$gforms = RGFormsModel::get_forms(null, "title");
foreach ($gforms as $k => $v) {
$forms[$v->id] = $v->title;
}
} else {
$forms = array('-1' => 'No Forms Found');
}
return $forms;
}
示例11: mab_gforms_meta_box
/**
* Outputs the GFORMS options metabox in action box edit screen
* @param object $post the current post
* @return html
*/
function mab_gforms_meta_box($post)
{
$MabBase = MAB();
$data['meta'] = $MabBase->get_mab_meta($post->ID);
$type = $MabBase->get_action_box_type($post->ID);
//Get gravity forms stuff
$forms = RGFormsModel::get_forms(null, 'title');
$data['forms'] = is_array($forms) ? $forms : array();
//error_log();
$filename = 'metabox/metabox.php';
$box = mab_gforms_get_view($filename, $data);
echo $box;
}
示例12: vc_vendor_gravityforms_load
function vc_vendor_gravityforms_load()
{
$gravity_forms_array[__('No Gravity forms found.', 'js_composer')] = '';
if (class_exists('RGFormsModel')) {
$gravity_forms = RGFormsModel::get_forms(1, 'title');
if ($gravity_forms) {
$gravity_forms_array = array(__('Select a form to display.', 'js_composer') => '');
foreach ($gravity_forms as $gravity_form) {
$gravity_forms_array[$gravity_form->title] = $gravity_form->id;
}
}
}
vc_map(array('name' => __('Gravity Form', 'js_composer'), 'base' => 'gravityform', 'icon' => 'icon-wpb-vc_gravityform', 'category' => __('Content', 'js_composer'), 'description' => __('Place Gravity form', 'js_composer'), 'params' => array(array('type' => 'dropdown', 'heading' => __('Form', 'js_composer'), 'param_name' => 'id', 'value' => $gravity_forms_array, 'save_always' => true, 'description' => __('Select a form to add it to your post or page.', 'js_composer'), 'admin_label' => true), array('type' => 'dropdown', 'heading' => __('Display Form Title', 'js_composer'), 'param_name' => 'title', 'value' => array(__('No', 'js_composer') => 'false', __('Yes', 'js_composer') => 'true'), 'save_always' => true, 'description' => __('Would you like to display the forms title?', 'js_composer'), 'dependency' => array('element' => 'id', 'not_empty' => true)), array('type' => 'dropdown', 'heading' => __('Display Form Description', 'js_composer'), 'param_name' => 'description', 'value' => array(__('No', 'js_composer') => 'false', __('Yes', 'js_composer') => 'true'), 'save_always' => true, 'description' => __('Would you like to display the forms description?', 'js_composer'), 'dependency' => array('element' => 'id', 'not_empty' => true)), array('type' => 'dropdown', 'heading' => __('Enable AJAX?', 'js_composer'), 'param_name' => 'ajax', 'value' => array(__('No', 'js_composer') => 'false', __('Yes', 'js_composer') => 'true'), 'save_always' => true, 'description' => __('Enable AJAX submission?', 'js_composer'), 'dependency' => array('element' => 'id', 'not_empty' => true)), array('type' => 'textfield', 'heading' => __('Tab Index', 'js_composer'), 'param_name' => 'tabindex', 'description' => __('(Optional) Specify the starting tab index for the fields of this form. Leave blank if you\'re not sure what this is.', 'js_composer'), 'dependency' => array('element' => 'id', 'not_empty' => true)))));
}
示例13: register_form_settings
public static function register_form_settings()
{
$settings = array();
$error = false;
// Settings
if (class_exists('RGFormsModel') && method_exists('RGFormsModel', 'get_forms')) {
$gravity_options = array(0 => self::__('No forms found'));
if (class_exists('RGFormsModel') && method_exists('RGFormsModel', 'get_forms')) {
$all_grav_forms = RGFormsModel::get_forms(1, 'title');
$gravity_options = array();
foreach ($all_grav_forms as $form) {
$gravity_options[absint($form->id)] = esc_html($form->title);
}
}
$settings = array(self::GRAVITY_FORM_ID => array('label' => self::__('GravityForms ID'), 'option' => array('type' => 'select', 'options' => $gravity_options, 'default' => self::$gravity_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Gravity Forms</a>.'), 'https://sproutapps.co/link/gravity-forms'))));
} elseif (function_exists('ninja_forms_get_all_forms')) {
$ninja_options = array(0 => self::__('No forms found'));
if (function_exists('ninja_forms_get_all_forms')) {
$all_ninja_forms = ninja_forms_get_all_forms();
$ninja_options = array();
foreach ($all_ninja_forms as $form) {
$ninja_options[$form['id']] = $form['data']['form_title'];
}
}
// Settings
$settings = array(self::NINJA_FORM_ID => array('label' => self::__('NinjaForms ID'), 'option' => array('type' => 'select', 'options' => $ninja_options, 'default' => self::$ninja_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Ninja Forms</a>.'), 'https://sproutapps.co/link/ninja-forms'))));
} elseif (function_exists('frm_forms_autoloader')) {
$frdbl_options = array(0 => self::__('No forms found'));
$forms = FrmForm::get_published_forms();
if (!empty($forms)) {
$frdbl_options = array();
foreach ($forms as $form) {
$frdbl_options[$form->id] = !isset($form->name) ? __('(no title)', 'formidable') : esc_attr(FrmAppHelper::truncate($form->name, 33));
}
}
// Settings
$settings = array(self::FORMIDABLE_FORM_ID => array('label' => self::__('Formidable ID'), 'option' => array('type' => 'select', 'options' => $frdbl_options, 'default' => self::$frdbl_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Formidable</a>.'), 'https://sproutapps.co/link/formidable'))));
} else {
// Settings
$settings = array(self::NINJA_FORM_ID => array('label' => self::__('Integration Error'), 'option' => array('type' => 'bypass', 'output' => sprintf(self::__('It looks like neither <a href="%s">Gravity Forms</a> or <a href="%s">Ninja Forms</a> or <a href="%s">Formidable</a> is active.'), 'https://sproutapps.co/link/gravity-forms', 'https://sproutapps.co/link/ninja-forms', 'https://sproutapps.co/link/formidable'))));
$error = true;
}
$map_settings = array();
if (!$error) {
// Settings
$map_settings = array(self::FORM_ID_MAPPING => array('label' => self::__('Form ID Mapping'), 'option' => array(__CLASS__, 'show_form_field_mapping'), 'sanitize_callback' => array(__CLASS__, 'save_form_field_mapping')));
}
return array_merge($settings, $map_settings);
}
示例14: setup_gravity_form_options
/**
* Set the available forms as field options
*/
public function setup_gravity_form_options()
{
if (!$this->is_plugin_active()) {
return;
}
$forms = \RGFormsModel::get_forms(null, 'title');
if (!is_array($forms) || empty($forms)) {
return;
}
$options = array('0' => __('No form', 'carbon-fields'));
foreach ($forms as $form) {
$options[$form->id] = $form->title;
}
$this->set_options($options);
}
示例15: select_box
static function select_box($name = '', $form = '')
{
$name = $name ? $name : 'gravity_form';
if (class_exists('RGFormsModel') && method_exists('RGFormsModel', 'get_forms')) {
$forms = \RGFormsModel::get_forms(null, 'title');
echo "<select class='plugin_admin_form' name='" . $name . "' >";
echo '<option value="">Choose a Form</option>';
foreach ($forms as $formid) {
echo '<option ' . ($formid->id == $form ? 'selected="true"' : '') . ' value="' . $formid->id . '">' . $formid->title . '</option>';
}
echo '</select>';
} else {
echo "<input class='plugin_admin_form' name='" . $name . "' type='text' value='" . esc_attr($form) . "' />";
}
}