$field_settings['rows'],
'quicktags' => false,
'media_buttons' => false,
'editor_class' => $req_class,
'textarea_name' => $field_settings['name'],
];
$editor_settings = apply_filters( 'wpuf_textarea_editor_args', $editor_settings );
wp_editor( $value, $textarea_id, $editor_settings );
} elseif ( $field_settings['rich'] == 'teeny' ) {
$editor_settings = [
'textarea_rows' => $field_settings['rows'],
'quicktags' => false,
'media_buttons' => false,
'teeny' => true,
'editor_class' => $req_class,
'textarea_name' => $field_settings['name'],
];
$editor_settings = apply_filters( 'wpuf_textarea_editor_args', $editor_settings );
wp_editor( $value, $textarea_id, $editor_settings );
} else {
?>
help_text( $field_settings );
if ( isset( $field_settings['content_restriction'] ) && $field_settings['content_restriction'] ) {
$this->check_content_restriction_func(
$field_settings['content_restriction'],
$field_settings['rich'],
$field_settings['name'] . '_' . $form_id,
$field_settings['restriction_type']
);
} ?>
get_default_option_settings( false, ['dynamic'] );
$default_text_options = $this->get_default_textarea_option_settings();
$settings = [
[
'name' => 'insert_image',
'title' => __( 'Enable Image Insertion', 'wp-user-frontend' ),
'type' => 'checkbox',
'options' => [ 'yes' => __( 'Enable image upload in post area', 'wp-user-frontend' ) ],
'is_single_opt' => true,
'section' => 'advanced',
'priority' => 14,
],
];
return array_merge( $default_options, $default_text_options, $settings );
}
/**
* Get the field props
*
* @return array
*/
public function get_field_props() {
$defaults = $this->default_attributes();
$props = [
'input_type' => 'textarea',
'is_meta' => 'no',
'name' => 'post_content',
'rows' => 5,
'cols' => 25,
'rich' => 'yes',
'id' => 0,
'is_new' => true,
'restriction_type' => 'character',
];
return array_merge( $defaults, $props );
}
/**
* Prepare entry
*
* @param $field
*
* @return mixed
*/
public function prepare_entry( $field ) {
check_ajax_referer( 'wpuf_form_add' );
$field = isset( $_POST[$field['name']] ) ? sanitize_text_field( wp_unslash( $_POST[$field['name']] ) ) : '';
return trim( $field );
}
}