本文整理汇总了PHP中GFAPI::add_form方法的典型用法代码示例。如果您正苦于以下问题:PHP GFAPI::add_form方法的具体用法?PHP GFAPI::add_form怎么用?PHP GFAPI::add_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFAPI
的用法示例。
在下文中一共展示了GFAPI::add_form方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cap_byline_activate
/**
* On CAP Byline activation run these actions
*/
function cap_byline_activate()
{
/**
* Create the Gravity Form contact form for bios
*/
if (function_exists('gform_notification')) {
$form = array('labelPlacement' => 'top_label', 'useCurrentUserAsAuthor' => 1, 'title' => __('Contact Author', 'cap-byline'), 'description' => __('Fill out the form below to contact this author', 'cap-byline'), 'descriptionPlacement' => 'below', 'button' => array('type' => 'text', 'text' => __('Submit', 'cap-byline')), 'fields' => array('0' => array('id' => '1', 'isRequired' => '1', 'size' => 'medium', 'type' => 'name', 'label' => __('Name', 'cap-byline'), 'inputs' => array('0' => array('id' => '1.3', 'label' => __('First', 'cap-byline')), '1' => array('id' => '1.6', 'label' => __('Last', 'cap-byline'))), 'formId' => '2', 'pageNumber' => '1', 'descriptionPlacement' => 'below'), '1' => array('id' => '2', 'isRequired' => '1', 'size' => 'medium', 'type' => 'email', 'label' => __('Email', 'cap-byline'), 'formId' => '2', 'pageNumber' => '1', 'descriptionPlacement' => 'below'), '2' => array('id' => '3', 'isRequired' => '1', 'size' => 'medium', 'type' => 'textarea', 'label' => __('Message', 'cap-byline'), 'formId' => '2', 'pageNumber' => '1', 'descriptionPlacement' => 'below'), '3' => array('allowsPrepopulate' => 1, 'id' => 4, 'size' => 'medium', 'type' => 'hidden', 'inputName' => 'author_contact_email', 'label' => __('To', 'cap-byline'), 'formId' => 2, 'pageNumber' => 1, 'descriptionPlacement' => 'below')), 'enableHoneypot' => '1', 'enableAnimation' => '1', 'id' => '2', 'notifications' => array('53a057ebea107' => array('id' => '53a057ebea107', 'to' => '{admin_email}', 'name' => __('Admin Notification', 'cap-byline'), 'event' => 'form_submission', 'toType' => 'email', 'subject' => sprintf(__('You have received a message from %s', 'cap-byline'), get_bloginfo('name')), 'message' => '{all_fields}')), 'confirmations' => array('53a057ebeadd6' => array('id' => '53a057ebeadd6', 'isDefault' => '1', 'type' => 'message', 'name' => __('Default Confirmation', 'cap-byline'), 'message' => __('Thank you for contacting me.', 'cap-byline'), 'disableAutoformat' => null, 'pageId' => null, 'url' => null, 'queryString' => null, 'conditionalLogic' => array())), 'is_active' => '1', 'date_created' => '2014-06-17 15:17:18', 'is_trash' => '0');
$form_id = GFAPI::add_form($form);
}
}
示例2: create_forms
public function create_forms()
{
$forms[0] = json_decode('{"title":"Simple Form Testing","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"id":1,"label":"Name","adminLabel":"","type":"name","isRequired":false,"size":"medium","errorMessage":"","inputs":[{"id":1.3,"label":"First","name":""},{"id":1.6,"label":"Last","name":""}],"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":2,"label":"Address","adminLabel":"","type":"address","isRequired":false,"size":"medium","errorMessage":"","inputs":[{"id":2.1,"label":"Street Address","name":""},{"id":2.2,"label":"Address Line 2","name":""},{"id":2.3,"label":"City","name":""},{"id":2.4,"label":"State \\/ Province","name":""},{"id":2.5,"label":"ZIP \\/ Postal Code","name":""},{"id":2.6,"label":"Country","name":""}],"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":3,"label":"Email","adminLabel":"","type":"email","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":4,"label":"Phone","adminLabel":"","type":"phone","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"phoneFormat":"standard","formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":5,"label":"Untitled","adminLabel":"","type":"select","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"choices":[{"text":"First Choice","value":"First Choice","isSelected":false,"price":""},{"text":"Second Choice","value":"Second Choice","isSelected":false,"price":""},{"text":"Third Choice","value":"Third Choice","isSelected":false,"price":""}],"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":6,"label":"Untitled","adminLabel":"","type":"multiselect","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"choices":[{"text":"First Choice","value":"First Choice","isSelected":false,"price":""},{"text":"Second Choice","value":"Second Choice","isSelected":false,"price":""},{"text":"Third Choice","value":"Third Choice","isSelected":false,"price":""}],"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":7,"label":"Untitled","adminLabel":"","type":"textarea","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"formId":47,"pageNumber":1,"descriptionPlacement":"below"}],"id":47,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"notifications":{"5414ff2b70018":{"id":"5414ff2b70018","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"},"5414ff5a5a28a":{"isActive":true,"id":"5414ff5a5a28a","name":"User Notification","event":"form_submission","to":"3","toType":"field","bcc":"","subject":"Email Notification","message":"User Notification","from":"{admin_email}","fromName":"","replyTo":"","routing":null,"conditionalLogic":null,"disableAutoformat":""}},"confirmations":{"5414ff2b752f0":{"id":"5414ff2b752f0","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}},"is_active":"1","date_created":"2014-09-14 02:36:27","is_trash":"0"}', true);
$forms[1] = json_decode('{"title":"Disable Form","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"id":1,"label":"Name","adminLabel":"","type":"name","isRequired":false,"size":"medium","errorMessage":"","inputs":[{"id":1.3,"label":"First","name":""},{"id":1.6,"label":"Last","name":""}],"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":2,"label":"Address","adminLabel":"","type":"address","isRequired":false,"size":"medium","errorMessage":"","inputs":[{"id":2.1,"label":"Street Address","name":""},{"id":2.2,"label":"Address Line 2","name":""},{"id":2.3,"label":"City","name":""},{"id":2.4,"label":"State \\/ Province","name":""},{"id":2.5,"label":"ZIP \\/ Postal Code","name":""},{"id":2.6,"label":"Country","name":""}],"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":3,"label":"Email","adminLabel":"","type":"email","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":4,"label":"Phone","adminLabel":"","type":"phone","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"phoneFormat":"standard","formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":5,"label":"Untitled","adminLabel":"","type":"select","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"choices":[{"text":"First Choice","value":"First Choice","isSelected":false,"price":""},{"text":"Second Choice","value":"Second Choice","isSelected":false,"price":""},{"text":"Third Choice","value":"Third Choice","isSelected":false,"price":""}],"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":6,"label":"Untitled","adminLabel":"","type":"multiselect","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"choices":[{"text":"First Choice","value":"First Choice","isSelected":false,"price":""},{"text":"Second Choice","value":"Second Choice","isSelected":false,"price":""},{"text":"Third Choice","value":"Third Choice","isSelected":false,"price":""}],"formId":47,"pageNumber":1,"descriptionPlacement":"below"},{"id":7,"label":"Untitled","adminLabel":"","type":"textarea","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"formId":47,"pageNumber":1,"descriptionPlacement":"below"}],"id":47,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"notifications":{"5414ff2b70018":{"id":"5414ff2b70018","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}"},"5414ff5a5a28a":{"isActive":true,"id":"5414ff5a5a28a","name":"User Notification","event":"form_submission","to":"3","toType":"field","bcc":"","subject":"Email Notification","message":"User Notification","from":"{admin_email}","fromName":"","replyTo":"","routing":null,"conditionalLogic":null,"disableAutoformat":""}},"confirmations":{"5414ff2b752f0":{"id":"5414ff2b752f0","name":"Default Confirmation","isDefault":true,"type":"message","message":"Thanks for contacting us! We will get in touch with you shortly.","url":"","pageId":"","queryString":""}},"is_active":"0","date_created":"2014-09-14 02:36:27","is_trash":"0"}', true);
foreach ($forms as $id => $form) {
$results = GFAPI::add_form($form);
/* test the form was correctly added to the database */
$this->assertInternalType('int', $results);
$this->form_id[$id] = $results;
}
}
示例3: 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);
}
示例4: aria_create_competition
function aria_create_competition($entry, $form)
{
// wp_die($competition_creation_form_id);
//echo $competition_creation_form_id . "<br>";
global $new_form_id;
wp_die($new_form_id);
if ($form['id'] == $new_form_id) {
//if ($form['id'] == $form_id) {
$competition_student_form = new GF_Form("Student Registration", "");
$result = GFAPI::add_form($competition_student_form->createFormArray());
} else {
echo "form's id: " . $form['id'] . "<br>";
echo "global form id: " . $new_form_id;
die;
}
}
示例5: create_stubs
/**
* Generate some placeholder values to test against
*/
private function create_stubs()
{
add_role('zero', "No Capabilities", array());
$this->form_id = GFAPI::add_form(array('title' => 'This is the form title', 'fields' => array(new GF_Field_Text(array('id' => 1, 'label' => 'Label for field one (text)', 'choices' => array(), 'inputs' => '')), new GF_Field_Hidden(array('id' => 2, 'label' => 'Label for field two (hidden)', 'choices' => array(), 'inputs' => '')), new GF_Field_Number(array('id' => 3, 'label' => 'Label for field three (number)', 'choices' => array(), 'inputs' => '')))));
$this->form = GFAPI::get_form($this->form_id);
$entry_array = array('form_id' => $this->form_id, '1' => 'Value for field one', '2' => 'Value for field two', '3' => '3.33333', 'ip' => '127.0.0.1', 'source_url' => 'http://example.com/wordpress/?gf_page=preview&id=16', 'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/7.0.6 Safari/537.78.2', 'payment_status' => 'Processing', 'payment_date' => '2014-08-29 20:55:06', 'payment_amount' => '0.01', 'transaction_id' => 'asdfpaoj442gpoagfadf', 'created_by' => 1, 'status' => 'active', 'date_created' => '2014-08-29 18:25:39');
$this->entry_id = GFAPI::add_entry($entry_array);
$this->entry = GFAPI::get_entry($this->entry_id);
}
示例6: create_object
function create_object($form)
{
return GFAPI::add_form($form);
}
示例7: aria_create_student_form
//.........这里部分代码省略.........
* @author KREW
*/
private static function aria_create_student_form($competition_entry)
{
$field_mapping = self::aria_get_competition_entry_meta();
$competition_name = $competition_entry[$field_mapping['Name of Competition']];
$student_form = new GF_Form("{$competition_name} Student Registration", "");
$field_id_array = self::aria_student_field_id_array();
// parent name
$parent_name_field = new GF_Field_Name();
$parent_name_field->label = "Parent Name";
$parent_name_field->id = $field_id_array['parent_name'];
$parent_name_field->isRequired = false;
$parent_name_field = self::aria_add_default_name_inputs($parent_name_field);
$student_form->fields[] = $parent_name_field;
// parent email
$parent_email_field = new GF_Field_Email();
$parent_email_field->label = "Parent's Email";
$parent_email_field->id = $field_id_array['parent_email'];
$parent_email_field->isRequired = false;
$student_form->fields[] = $parent_email_field;
// student name
$student_name_field = new GF_Field_Name();
$student_name_field->label = "Student Name";
$student_name_field->description = "Please capitalize your child's first " . "and last names and double check the spelling. The way you type the name " . "here is the way it will appear on all awards and in the Command " . "Performance program.";
$student_name_field->descriptionPlacement = 'above';
$student_name_field->id = $field_id_array['student_name'];
$student_name_field->isRequired = true;
$student_name_field = self::aria_add_default_name_inputs($student_name_field);
$student_form->fields[] = $student_name_field;
// student birthday
$student_birthday_date_field = new GF_Field_Date();
$student_birthday_date_field->label = "Student Birthday";
$student_birthday_date_field->id = $field_id_array['student_birthday'];
$student_birthday_date_field->isRequired = false;
$student_birthday_date_field->calendarIconType = 'calendar';
$student_birthday_date_field->dateType = 'datepicker';
$student_form->fields[] = $student_birthday_date_field;
// student's piano teacher
$piano_teachers_field = new GF_Field_Select();
$piano_teachers_field->label = "Piano Teacher's Name";
$piano_teachers_field->id = $field_id_array['teacher_name'];
$piano_teachers_field->isRequired = true;
$piano_teachers_field->description = "TBD";
$piano_teachers_field->choices = array(array('text' => 'Test 1', 'value' => 'Tim', 'isSelected' => false), array('text' => 'Test 2', 'value' => 'Jim', 'isSelected' => false));
$student_form->fields[] = $piano_teachers_field;
// student's piano teacher does not exist
$teacher_missing_field = new GF_Field_Text();
$teacher_missing_field->label = "If your teacher's name is not listed, " . "enter name below.";
$teacher_missing_field->id = $field_id_array['not_listed_teacher_name'];
$teacher_missing_field->isRequired = false;
$student_form->fields[] = $teacher_missing_field;
// student's available times to compete
$available_times = new GF_Field_Checkbox();
$available_times->label = "Available Festival Days (check all available times)";
$available_times->id = $field_id_array['available_festival_days'];
$available_times->isRequired = false;
$available_times->description = "There is no guarantee that scheduling " . "requests will be honored.";
$available_times->choices = array(array('text' => 'Saturday', 'value' => 'Saturday', 'isSelected' => false), array('text' => 'Sunday', 'value' => 'Sunday', 'isSelected' => false));
$available_times->inputs = array();
$available_times = self::aria_add_checkbox_input($available_times, 'Saturday');
$available_times = self::aria_add_checkbox_input($available_times, 'Sunday');
$student_form->fields[] = $available_times;
// student's available times to compete for command performance
$command_times = new GF_Field_Checkbox();
$command_times->label = "Preferred Command Performance Time (check all available times)";
$command_times->id = $field_id_array['preferred_command_performance'];
$command_times->isRequired = false;
$command_times->description = "Please check the Command Performance time " . "that you prefer in the event that your child receives a superior rating.";
$command_times->choices = array(array('text' => 'Thursday 5:30', 'value' => 'Thursday 5:30', 'isSelected' => false), array('text' => 'Thursday 7:30', 'value' => 'Sunday', 'isSelected' => false));
$command_times->inputs = array();
$command_times = self::aria_add_checkbox_input($command_times, 'Thursday 5:30');
$command_times = self::aria_add_checkbox_input($command_times, 'Thursday 7:30');
$student_form->fields[] = $command_times;
// the compliance field for parents
$compliance_field = new GF_Field_checkbox();
$compliance_field->label = "Compliance Statement";
$compliance_field->id = $field_id_array['compliance_statement'];
$compliance_field->isRequired = true;
$compliance_field->description = "As a parent, I understand and agree to " . "comply with all rules, regulations, and amendments as stated in the " . "Festival syllabus. I am in full compliance with the laws regarding " . "photocopies and can provide verification of authentication of any legally " . "printed music. I understand that adjudicator decisions are final and " . "will not be contested. I know that small children may not remain in the " . "room during performances of non-family members. I understand that " . "requests for specific days/times will be scheduled if possible but cannot" . " be guaranteed.";
$compliance_field->choices = array(array('text' => 'I have read and agree with the following statement:', 'value' => 'Agree', 'isSelected' => false));
$compliance_field->inputs = array();
$compliance_field = self::aria_add_checkbox_input($compliance_field, 'I have read and agree with the following statement:');
$student_form->fields[] = $compliance_field;
// custom submission message to let the festival chairman know the creation was
// a success
$successful_submission_message = 'Congratulations! You have just';
$successful_submission_message .= ' successfully registered your child.';
$student_form->confirmation['type'] = 'message';
$student_form->confirmation['message'] = $successful_submission_message;
$student_form_arr = $student_form->createFormArray();
$student_form_arr['isStudentPublicForm'] = true;
// add the new form to the festival chairman's dashboard
$new_form_id = GFAPI::add_form($student_form_arr);
// make sure the new form was added without error
if (is_wp_error($new_form_id)) {
wp_die($new_form_id->get_error_message());
}
return $new_form_id;
}
示例8: create_object
function create_object($file, $parent = 0, $args = array())
{
$args = wp_parse_args($args, $this->default_generation_definitions);
return GFAPI::add_form($args);
}
示例9: aria_create_nnmta_music_form
/**
* This function is responsible for creating the NNMTA music form if it does
* not previously exist.
*
* This function is intended to be used in the event where the festival
* chairman tries to upload music to the NNMTA database but no such form
* exists for adding music.
*
* @author KREW
* @since 1.0.0
*/
private static function aria_create_nnmta_music_form()
{
$nnmta_music_form_name = "NNMTA Music Database";
$nnmta_music_form = new GF_Form($nnmta_music_form_name, "");
$field_id_arr = self::aria_music_field_id_array();
// NNMTA song name
$song_name_field = new GF_Field_Text();
$song_name_field->label = "Song Name";
$song_name_field->id = $field_id_arr['song_name'];
$song_name_field->isRequired = true;
$nnmta_music_form->fields[] = $song_name_field;
// NNMTA song composer
$song_composer_field = new GF_Field_Text();
$song_composer_field->label = "Composer Name";
$song_composer_field->id = $field_id_arr['song_composer'];
$song_composer_field->isRequired = true;
$nnmta_music_form->fields[] = $song_composer_field;
// NNMTA song level
$song_level_field = new GF_Field_Text();
$song_level_field->label = "Song Level";
$song_level_field->id = $field_id_arr['song_level'];
$song_level_field->isRequired = true;
$nnmta_music_form->fields[] = $song_level_field;
// NNMTA period level
$song_period_field = new GF_Field_Text();
$song_period_field->label = "Song Period";
$song_period_field->id = $field_id_arr['song_period'];
$song_period_field->isRequired = true;
$nnmta_music_form->fields[] = $song_period_field;
// NNMTA song catalog
$song_catalog_field = new GF_Field_Text();
$song_catalog_field->label = "Song Catalog";
$song_catalog_field->id = $field_id_arr['song_catalog'];
$song_catalog_field->isRequired = false;
$nnmta_music_form->fields[] = $song_catalog_field;
// add the new form to the festival chairman's dashboard
$new_form_id = GFAPI::add_form($nnmta_music_form->createFormArray());
// make sure the new form was added without error
if (is_wp_error($new_form_id)) {
wp_die($new_form_id->get_error_message());
}
}
示例10: aria_create_teacher_master_form
/**
* This function will create the form that will be the source of truth for
* a certain competitions teachers.
*
* This function is called in "class-aria-create-competition.php" and is
* responsible for creating the teacher master form. This form is the absolute
* source of truth for the teachers of any given competition. Entries in other
* forms will update entries in this form.
*
* @param $competition_name String The competition name
*
* @since 1.0.0
* @author KREW
*/
public static function aria_create_teacher_master_form($competition_name)
{
$teacher_master_form = new GF_Form($competition_name . " Teacher Master", "");
$field_id_array = self::aria_master_teacher_field_id_array();
// Students
$parent_name_field = new GF_Field_List();
$parent_name_field->label = "Students";
$parent_name_field->id = $field_id_array['students'];
$teacher_master_form->fields[] = $parent_name_field;
// teacher name
$teacher_name_field = new GF_Field_Name();
$teacher_name_field->label = "Name";
$teacher_name_field->id = $field_id_array['name'];
$teacher_name_field->isRequired = false;
$teacher_name_field = ARIA_Create_Competition::aria_add_default_name_inputs($teacher_name_field);
$teacher_master_form->fields[] = $teacher_name_field;
// teacher email
$teacher_email_field = new GF_Field_Email();
$teacher_email_field->label = "Email";
$teacher_email_field->id = $field_id_array['email'];
$teacher_email_field->isRequired = false;
$teacher_master_form->fields[] = $teacher_email_field;
// teacher phone
$teacher_phone_field = new GF_Field_Phone();
$teacher_phone_field->label = "Phone";
$teacher_phone_field->id = $field_id_array['phone'];
$teacher_phone_field->isRequired = false;
$teacher_master_form->fields[] = $teacher_phone_field;
// !!!new field
// teacher is judging
$teacher_judging_field = new GF_Field_Radio();
$teacher_judging_field->label = "Are you scheduled to judge for the festival?";
$teacher_judging_field->id = $field_id_array['is_judging'];
$teacher_judging_field->isRequired = false;
$teacher_judging_field->choices = array(array('text' => 'Yes', 'value' => 'Yes', 'isSelected' => false), array('text' => 'No', 'value' => 'No', 'isSelected' => false));
$conditionalRules = array();
$conditionalRules[] = array('fieldId' => $field_id_array['is_judging'], 'operator' => 'is', 'value' => 'No');
$teacher_master_form->fields[] = $teacher_judging_field;
// teacher volunteer preference
$volunteer_preference_field = new GF_Field_Checkbox();
$volunteer_preference_field->label = "Volunteer Preference";
$volunteer_preference_field->id = $field_id_array['volunteer_preference'];
$volunteer_preference_field->isRequired = false;
/*!!! $volunteer_preference_field->choices = array(
array('text' => 'Section Proctor', 'value' => 'Section Proctor', 'isSelected' => false),
array('text' => 'Posting Results', 'value' => 'Posting Results', 'isSelected' => false),
array('text' => 'Information Table', 'value' => 'Information Table', 'isSelected' => false),
array('text' => 'Greeting and Assisting with Locating Rooms', 'value' => 'Greeting', 'isSelected' => false),
array('text' => 'Hospitality (managing food in judges rooms)', 'value' => 'Hospitality', 'isSelected' => false)
);
$volunteer_preference_field->description = "Please check 1 time slot if you"
." have 1-3 students competing, 2 time slots if you have 4-6 students"
." competing, and 3 time slots if you have more than 6 students competing.";
*/
$volunteer_preference_field->choices = array(array('text' => 'Proctor sessions', 'value' => 'Proctor sessions', 'isSelected' => false), array('text' => 'Monitor door during sessions', 'value' => 'Monitor door during sessions', 'isSelected' => false), array('text' => 'Greet students and parents', 'value' => 'Greet students and parents', 'isSelected' => false), array('text' => 'Prepare excellent ribbons', 'value' => 'Prepare excellent ribbons', 'isSelected' => false), array('text' => 'Put seals on certificates', 'value' => 'Put seals on certificates', 'isSelected' => false), array('text' => 'Early set up', 'value' => 'Early set up', 'isSelected' => false), array('text' => 'Clean up', 'value' => 'Clean up', 'isSelected' => false), array('text' => 'Help with food for judges and volunteers', 'value' => 'Help with food for judges and volunteers', 'isSelected' => false));
$volunteer_preference_field->description = "Please check at least two volunteer job" . "preferences for this year's Festival. You will be notified by email of your" . "volunteer assignments as Festival approaches.";
$volunteer_preference_field->conditionalLogic = array('actionType' => 'show', 'logicType' => 'all', 'rules' => $conditionalRules);
$teacher_master_form->fields[] = $volunteer_preference_field;
// volunteer time
$volunteer_time_field = new GF_Field_Checkbox();
$volunteer_time_field->label = "Times Available for Volunteering";
$volunteer_time_field->id = $field_id_array['volunteer_time'];
$volunteer_time_field->isRequired = false;
$volunteer_time_field->description = "Please check at least two times you are" . "available to volunteer during Festival weekend.";
$volunteer_time_field->conditionalLogic = array('actionType' => 'show', 'logicType' => 'all', 'rules' => $conditionalRules);
$teacher_master_form->fields[] = $volunteer_time_field;
// student's hash
$teacher_hash_field = new GF_Field_Text();
$teacher_hash_field->id = $field_id_array['hash'];
$teacher_hash_field->isRequired = false;
$teacher_master_form->fields[] = $teacher_hash_field;
$teacher_master_form_array = $teacher_master_form->createFormArray();
$teacher_master_form_array['isTeacherMasterForm'] = true;
return GFAPI::add_form($teacher_master_form_array);
}