本文整理匯總了PHP中GFFormDisplay::get_source_page方法的典型用法代碼示例。如果您正苦於以下問題:PHP GFFormDisplay::get_source_page方法的具體用法?PHP GFFormDisplay::get_source_page怎麽用?PHP GFFormDisplay::get_source_page使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GFFormDisplay
的用法示例。
在下文中一共展示了GFFormDisplay::get_source_page方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* initialise instance
* @param array $form
*/
public function __construct(&$form)
{
// check for last page
$current_page = GFFormDisplay::get_source_page($form['id']);
$target_page = GFFormDisplay::get_target_page($form, $current_page, rgpost('gform_field_values'));
$this->isLastPageFlag = $target_page == 0;
// load the form data
$this->loadForm($form);
}
示例2: is_applicable_field
function is_applicable_field($field, $form)
{
if ($field['pageNumber'] != GFFormDisplay::get_source_page($form['id'])) {
return false;
}
if ($field['type'] != 'list' || RGFormsModel::is_field_hidden($form, $field, array())) {
return false;
}
// if the field has already failed validation, we don't need to fail it again
if (!$field['isRequired'] || $field['failed_validation']) {
return false;
}
if (empty($this->field_ids)) {
return true;
}
return in_array($field['id'], $this->field_ids);
}
示例3: should_field_be_validated
function should_field_be_validated($form, $field)
{
if ($field['pageNumber'] != GFFormDisplay::get_source_page($form['id'])) {
return false;
}
// if no limits provided for this field
if (!$this->get_field_limits($field['id'])) {
return false;
}
// or if this field is not a checkbox
if (RGFormsModel::get_input_type($field) != 'checkbox') {
return false;
}
// or if this field is hidden
if (RGFormsModel::is_field_hidden($form, $field, array())) {
return false;
}
return true;
}
示例4: validate_credit_card
public function validate_credit_card($validation_result)
{
if (!$this->has_feed($validation_result['form']['id'], true)) {
return $validation_result;
}
foreach ($validation_result['form']['fields'] as &$field) {
$current_page = GFFormDisplay::get_source_page($validation_result['form']['id']);
$field_on_curent_page = $current_page > 0 && $field['pageNumber'] == $current_page;
if (GFFormsModel::get_input_type($field) != 'creditcard' || !$field_on_curent_page) {
continue;
}
if ($this->get_stripe_js_error()) {
$field['failed_validation'] = true;
$field['validation_message'] = $this->get_stripe_js_error();
} else {
// override validation in case user has marked field as required allowing stripe to handle cc validation
$field['failed_validation'] = false;
}
// only one cc field per form, break once we've found it
break;
}
// revalidate the validaiton result
$validation_result['is_valid'] = true;
foreach ($validation_result['form']['fields'] as &$field) {
if ($field['failed_validation']) {
$validation_result['is_valid'] = false;
break;
}
}
return $validation_result;
}
示例5: is_last_page
private static function is_last_page($form)
{
$current_page = GFFormDisplay::get_source_page($form["id"]);
$target_page = GFFormDisplay::get_target_page($form, $current_page, rgpost("gform_field_values"));
return $target_page == 0;
}