本文整理汇总了PHP中GFFormDisplay::get_first_page_with_error方法的典型用法代码示例。如果您正苦于以下问题:PHP GFFormDisplay::get_first_page_with_error方法的具体用法?PHP GFFormDisplay::get_first_page_with_error怎么用?PHP GFFormDisplay::get_first_page_with_error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFFormDisplay
的用法示例。
在下文中一共展示了GFFormDisplay::get_first_page_with_error方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_form
//.........这里部分代码省略.........
// Separate the CSS classes.
$form_css_classes = explode(' ', $form_css_class);
// Append _wrapper to each class.
foreach ($form_css_classes as &$wrapper_class) {
$wrapper_class .= '_wrapper';
}
// Merge back into a string.
$custom_wrapper_css_class = ' ' . implode(' ', $form_css_classes);
}
$form_string .= "\n <div class='{$wrapper_css_class}{$custom_wrapper_css_class}' id='gform_wrapper_{$form_id}' " . $style . '>';
$default_anchor = $has_pages || $ajax ? true : false;
$use_anchor = gf_apply_filters(array('gform_confirmation_anchor', $form_id), $default_anchor, $form);
if ($use_anchor !== false) {
$form_string .= "<a id='gf_{$form_id}' class='gform_anchor' ></a>";
$action .= "#gf_{$form_id}";
}
$target = $ajax ? "target='gform_ajax_frame_{$form_id}'" : '';
$form_css_class = !empty($form['cssClass']) ? "class='{$form_css_class}'" : '';
$action = esc_url($action);
$form_string .= gf_apply_filters(array('gform_form_tag', $form_id), "<form method='post' enctype='multipart/form-data' {$target} id='gform_{$form_id}' {$form_css_class} action='{$action}'>", $form);
if ($display_title || $display_description) {
$form_string .= "\n <div class='gform_heading'>";
if ($display_title) {
$form_string .= "\n <h3 class='gform_title'>" . $form['title'] . '</h3>';
}
if ($display_description) {
$form_string .= "\n <span class='gform_description'>" . rgar($form, 'description') . '</span>';
}
$form_string .= '
</div>';
}
/* If the form was submitted, has multiple pages and is invalid, set the current page to the first page with an invalid field. */
if ($has_pages && $is_postback && !$is_valid) {
self::set_current_page($form_id, GFFormDisplay::get_first_page_with_error($form));
}
$current_page = self::get_current_page($form_id);
if ($has_pages && !$is_admin) {
if ($form['pagination']['type'] == 'percentage') {
$form_string .= self::get_progress_bar($form, $current_page, $confirmation_message);
} else {
if ($form['pagination']['type'] == 'steps') {
$form_string .= self::get_progress_steps($form, $current_page);
}
}
}
if ($is_postback && !$is_valid) {
$validation_message = "<div class='validation_error'>" . esc_html__('There was a problem with your submission.', 'gravityforms') . ' ' . esc_html__('Errors have been highlighted below.', 'gravityforms') . '</div>';
$form_string .= gf_apply_filters(array('gform_validation_message', $form_id), $validation_message, $form);
}
$form_string .= "\n <div class='gform_body'>";
//add first page if this form has any page fields
if ($has_pages) {
$style = self::is_page_active($form_id, 1) ? '' : "style='display:none;'";
$class = !empty($form['firstPageCssClass']) ? " {$form['firstPageCssClass']}" : '';
$class = esc_attr($class);
$form_string .= "<div id='gform_page_{$form_id}_1' class='gform_page{$class}' {$style}>\n <div class='gform_page_fields'>";
}
$description_class = rgar($form, 'descriptionPlacement') == 'above' ? 'description_above' : 'description_below';
$sublabel_class = rgar($form, 'subLabelPlacement') == 'above' ? 'form_sublabel_above' : 'form_sublabel_below';
$form_string .= "<ul id='gform_fields_{$form_id}' class='" . GFCommon::get_ul_classes($form) . "'>";
if (is_array($form['fields'])) {
foreach ($form['fields'] as $field) {
/* @var GF_Field $field */
$field->conditionalLogicFields = self::get_conditional_logic_fields($form, $field->id);
if (is_array($submitted_values)) {
$field_value = rgar($submitted_values, $field->id);