<?php class ReduxFramework_password {

    /**
     * Field Constructor.
     *
     * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
     *
     * @since ReduxFramework 1.0.1
    */
    function __construct( $field = array(), $value ='', $parent ) {
      $this->field = $field;
			$this-&gt;value = $value;
			$this-&gt;args = $parent-&gt;args;
    }

    /**
     * Field Render Function.
     *
     * Takes the vars and outputs the HTML for the field in the settings
     *
     * @since ReduxFramework 1.0.1
    */
    function render() {
    	if (!empty($this-&gt;field['username']) &amp;&amp; $this-&gt;field['username'] === true ) {
    		$defaults = array(
    				'username'=&gt;'',
    				'password'=&gt;'',
                    'placeholder' =&gt; array('password'=&gt;__( 'Password', 'redux-framework' ), 'username'=&gt;__( 'Username', 'redux-framework' ))
    			);
    		$this-&gt;value = wp_parse_args( $this-&gt;value, $defaults );
    	}
    
        if ( !empty($this-&gt;field['placeholder'] ) ) {
            if ( is_array( $this-&gt;field['placeholder'] ) &amp;&amp; !empty( $this-&gt;field['placeholder']['password'] ) ) {
                $this-&gt;value['placeholder']['password'] = $this-&gt;field['placeholder']['password'];
            }
            if ( is_array( $this-&gt;field['placeholder'] ) &amp;&amp; !empty( $this-&gt;field['placeholder']['username'] ) ) {
                $this-&gt;value['placeholder']['username'] = $this-&gt;field['placeholder']['username'];
            }                
        } else {
            $this-&gt;value['placeholder']['password'] = $this-&gt;field['placeholder'];
        }

        if (!empty($this-&gt;field['username']) &amp;&amp; $this-&gt;field['username'] === true ) {
    		echo '<input type="input" autocomplete="off" placeholder="'.$this-&gt;value['placeholder']['username'].'" id="' . $this-&gt;field['id'] . '[username]" name="' . $this-&gt;args['opt_name'] . '[' . $this-&gt;field['id'] . '][username]" value="' . esc_attr($this-&gt;value['username']) . '" class="regular-text ' . $this-&gt;field['class'] . '" style="margin-right: 5px;">';
    		echo '<input type="password" autocomplete="off" placeholder="'.$this-&gt;value['placeholder']['password'].'" id="' . $this-&gt;field['id'] . '[password]" name="' . $this-&gt;args['opt_name'] . '[' . $this-&gt;field['id'] . '][password]" value="' . esc_attr($this-&gt;value['password']) . '" class="regular-text ' . $this-&gt;field['class'] . '">';
    	} else {
    		echo '<input type="password" autocomplete="off" placeholder="'.$this-&gt;value['placeholder']['password'].'" id="' . $this-&gt;field['id'] . '" name="' . $this-&gt;args['opt_name'] . '[' . $this-&gt;field['id'] . ']" value="' . esc_attr($this-&gt;value) . '" class="' . $this-&gt;field['class'] . '">';
    	}
        
    }
}
