namespace WPForms\Forms\Fields\Content;
use WPForms\Forms\Fields\Traits\ProField as ProFieldTrait;
use WPForms\Forms\Fields\Traits\ContentInput;
* The Content Field Class.
class Field extends WPForms_Field {
* Class initialization method.
// Define field type information.
$this->name = esc_html__( 'Content', 'wpforms-lite' );
$this->keywords = esc_html__( 'image, text, table, list, heading, wysiwyg, visual', 'wpforms-lite' );
$this->icon = 'fa-file-image-o';
$this->allow_read_only = false;
$this->default_settings = [
protected function hooks() {
* Show field options in the builder left panel.
* @param array $field Field data.
public function field_options( $field ) {
'after_title' => $this->get_field_options_notice(),
$this->field_option_content( $field );
// Set label to the disabled.
'slug' => 'label_disable',
$this->field_element( 'text', $field, $args );
$this->field_option( 'basic-options', $field, [ 'markup' => 'close' ] );
$this->field_option( 'advanced-options', $field, [ 'markup' => 'open' ] );
$this->field_option( 'size', $field );
$this->field_option( 'css', $field );
$this->field_option( 'advanced-options', $field, [ 'markup' => 'close' ] );
* Show the field preview in the builder right panel.
* @param array $field Field data.
public function field_preview( $field ) {
if ( ! empty( $this->is_disabled_field ) ) {
$field['label'] = empty( $field['label'] ) ? esc_html__( 'Content', 'wpforms-lite' ) : $field['label'];
$this->field_preview_option(
'label_badge' => $this->get_field_preview_badge(),
$this->content_input_preview( $field );
* Field display on the form front-end.
* @param array $field Field data and settings.
* @param array $deprecated Deprecated field attributes. Use field properties instead.
* @param array $form_data Form data and settings.
public function field_display( $field, $deprecated, $form_data ) {