',
esc_html__( 'Entry preview will be displayed here and will contain all fields found on the previous page.', 'wpforms-lite' ),
$is_disabled ? ' style="display: none"' : ''
);
}
/**
* Display the field input elements on the frontend.
*
* @since 1.9.4
*
* @param array $field Field data and settings.
* @param array $deprecated Field attributes.
* @param array $form_data Form data and settings.
*/
public function field_display( $field, $deprecated, $form_data ) {
}
/**
* Add custom JS i18n strings for the builder.
*
* @since 1.9.4
*
* @param array|mixed $strings List of strings.
* @param array $form Current form.
*
* @return array
* @noinspection PhpMissingParamTypeInspection
* @noinspection PhpUnusedParameterInspection
*/
public function add_builder_strings( $strings, $form ): array {
$strings = (array) $strings;
$strings['entry_preview_require_page_break'] = esc_html__( 'Page breaks are required for entry previews to work. If you\'d like to remove page breaks, you\'ll have to first remove the entry preview field.', 'wpforms-lite' );
$strings['entry_preview_default_notice'] = self::get_default_notice();
$strings['entry_preview_require_previous_button'] = esc_html__( 'You can\'t hide the previous button because it is required for the entry preview field on this page.', 'wpforms-lite' );
return $strings;
}
/**
* Get default notice.
*
* @since 1.9.4
*
* @return string
*/
protected static function get_default_notice(): string {
return sprintf(
"%s\n%s",
esc_html__( 'This is a preview of your submission. It has not been submitted yet!', 'wpforms-lite' ),
esc_html__( 'Please take a moment to verify your information. You can also go back to make changes.', 'wpforms-lite' )
);
}
/**
* Get a list of available styles.
*
* @since 1.9.4
*
* @return array
*/
protected static function get_styles(): array {
return [
'basic' => esc_html__( 'Basic', 'wpforms-lite' ),
'compact' => esc_html__( 'Compact', 'wpforms-lite' ),
'table' => esc_html__( 'Table', 'wpforms-lite' ),
'table_compact' => esc_html__( 'Table, Compact', 'wpforms-lite' ),
];
}
/**
* Disallow the field preview "Duplicate" button.
*
* @since 1.9.9
*
* @param bool|mixed $display Display switch.
* @param array $field Field settings.
*
* @return bool
*/
public function field_display_duplicate_button( $display, array $field ): bool {
$type = $field['type'] ?? '';
if ( $type === $this->type ) {
// Pagebreak fields cannot be duplicated.
return false;
}
return (bool) $display;
}
}