name = __( 'Post Title', 'wp-user-frontend' ); $this->input_type = 'post_title'; $this->icon = 'header'; } /** * Render the PostTitle field * * @param array $field_settings * @param int $form_id * * @return void */ public function render( $field_settings, $form_id, $type = 'post', $post_id = null ) { if ( isset( $post_id ) ) { $value = get_post_field( $field_settings['name'], $post_id ); } else { $value = $field_settings['default']; } ?>
  • print_list_attributes( $field_settings ); ?>> print_label( $field_settings, $form_id ); ?>
    help_text( $field_settings ); ?>
    check_content_restriction_func( $field_settings['content_restriction'], 'no', $field_settings['name'] . '_' . $form_id, $field_settings['restriction_type'] ); } $mask_option = isset( $field_settings['mask_options'] ) ? $field_settings['mask_options'] : ''; if ( $mask_option ) { ?>
  • get_default_option_settings( false, ['dynamic'] ); $default_text_options = $this->get_default_text_option_settings( true ); return array_merge( $default_options, $default_text_options ); } /** * Get the field props * * @return array */ public function get_field_props() { $defaults = $this->default_attributes(); $props = [ 'input_type' => 'text', 'is_meta' => 'no', 'name' => 'post_title', 'width' => 'large', 'size' => 40, '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 $field; } }