Edit File by line
/home/barbar84/www/wp-conte.../plugins/ninja-fo.../includes/Fields
File: Unknown.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Class NF_Fields_Unknown
[3] Fix | Delete
*/
[4] Fix | Delete
class NF_Fields_Unknown extends NF_Fields_Hidden
[5] Fix | Delete
{
[6] Fix | Delete
protected $_name = 'unknown';
[7] Fix | Delete
[8] Fix | Delete
protected $_type = 'unknown';
[9] Fix | Delete
[10] Fix | Delete
protected $_section = '';
[11] Fix | Delete
[12] Fix | Delete
protected $_icon = 'question';
[13] Fix | Delete
[14] Fix | Delete
protected $_templates = 'null';
[15] Fix | Delete
[16] Fix | Delete
protected $_aliases = array();
[17] Fix | Delete
[18] Fix | Delete
protected $_settings_only = array(
[19] Fix | Delete
'label', 'default'
[20] Fix | Delete
);
[21] Fix | Delete
[22] Fix | Delete
public function __construct()
[23] Fix | Delete
{
[24] Fix | Delete
parent::__construct();
[25] Fix | Delete
[26] Fix | Delete
$this->_nicename = esc_html__( 'Unknown', 'ninja-forms' );
[27] Fix | Delete
[28] Fix | Delete
$this->_settings[ 'message' ] = array(
[29] Fix | Delete
'name' => 'message',
[30] Fix | Delete
'type' => 'html',
[31] Fix | Delete
'label' => '',
[32] Fix | Delete
'width' => 'full',
[33] Fix | Delete
'group' => 'primary',
[34] Fix | Delete
);
[35] Fix | Delete
[36] Fix | Delete
$this->_settings[ 'label' ][ 'group' ] = '';
[37] Fix | Delete
[38] Fix | Delete
unset( $this->_settings[ 'default' ] ); // TODO: Seeing an error when removing default form the $_settings_only property, so just unsetting it here for now.
[39] Fix | Delete
[40] Fix | Delete
add_filter( 'nf_sub_hidden_field_types', array( $this, 'hide_field_type' ) );
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
public function validate( $field, $data )
[44] Fix | Delete
{
[45] Fix | Delete
return array(); // Return empty array with no errors.
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
function hide_field_type( $field_types )
[49] Fix | Delete
{
[50] Fix | Delete
$field_types[] = $this->_name;
[51] Fix | Delete
return $field_types;
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
public static function create( $field )
[55] Fix | Delete
{
[56] Fix | Delete
$unknown = Ninja_Forms()->form()->field()->get();
[57] Fix | Delete
if( is_object( $field ) ){
[58] Fix | Delete
$unknown->update_settings(array(
[59] Fix | Delete
'id' => $field->get_id(),
[60] Fix | Delete
'label' => $field->get_setting( 'label' ),
[61] Fix | Delete
'order' => $field->get_setting( 'order' ),
[62] Fix | Delete
'key' => $field->get_setting( 'key' ),
[63] Fix | Delete
'type' => 'unknown',
[64] Fix | Delete
'message' => sprintf( esc_html__( 'Field type "%s" not found.', 'ninja-forms' ), $field->get_setting( 'type' ) )
[65] Fix | Delete
));
[66] Fix | Delete
} elseif( isset( $field[ 'settings' ] ) ){
[67] Fix | Delete
$unknown->update_settings(array(
[68] Fix | Delete
'id' => $field[ 'id' ],
[69] Fix | Delete
'label' => $field[ 'settings' ][ 'label' ],
[70] Fix | Delete
'order' => $field[ 'settings' ][ 'order' ],
[71] Fix | Delete
'key' => $field[ 'settings' ][ 'key' ],
[72] Fix | Delete
'type' => 'unknown',
[73] Fix | Delete
'message' => sprintf( esc_html__( 'Field type "%s" not found.', 'ninja-forms' ), $field[ 'settings' ][ 'type' ] )
[74] Fix | Delete
));
[75] Fix | Delete
} else {
[76] Fix | Delete
$unknown->update_settings(array(
[77] Fix | Delete
'id' => $field[ 'id' ],
[78] Fix | Delete
'label' => $field[ 'label' ],
[79] Fix | Delete
'order' => $field[ 'order' ],
[80] Fix | Delete
'key' => $field[ 'key' ],
[81] Fix | Delete
'type' => 'unknown',
[82] Fix | Delete
'message' => sprintf( esc_html__( 'Field type "%s" not found.', 'ninja-forms' ), $field[ 'type' ] )
[83] Fix | Delete
));
[84] Fix | Delete
}
[85] Fix | Delete
return $unknown;
[86] Fix | Delete
}
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function