[ Index ]

MailPress 7.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/options/form/field_types/radio/ -> radio.php (source)

   1  <?php
   2  class MP_Form_field_type_radio extends MP_form_field_type_
   3  {
   4      var $file         = __FILE__;
   5  
   6      var $id         = 'radio';
   7  
   8      var $category     = 'html';
   9  
  10      var $order     = 40;
  11  
  12  	function submitted( $field )
  13      {
  14          $this->field = $field;
  15  
  16          $post_ = filter_input_array( INPUT_POST );
  17          $value = ( isset( $post_[$this->prefix][$this->field->form_id][$this->prefix . $this->field->settings['attributes']['name']] ) ) ? $post_[$this->prefix][$this->field->form_id][$this->prefix . $this->field->settings['attributes']['name']] : false;
  18  
  19          $required     = ( isset( $this->field->settings['controls']['required'] ) && $this->field->settings['controls']['required'] );
  20          $empty     = ( $value === false ) ? true : false;
  21  
  22          if ( $required && $empty )
  23          {
  24              $this->field->submitted['on_error'] = 1;
  25              return $this->field;
  26          }
  27  
  28          if ( $value === $this->field->settings['attributes']['value'] )
  29          {
  30              $this->field->submitted['value'] = $value;
  31              $this->field->submitted['text']  = sprintf( __( '"%1$s" checked', 'MailPress' ), $value );
  32              return $this->field;
  33          }
  34  
  35          return $this->field;
  36      }
  37  
  38  	function attributes_filter( $no_reset )
  39      {
  40          if ( !$no_reset ) return;
  41  
  42          $post_ = filter_input_array( INPUT_POST );
  43  
  44          unset( $this->field->setting['attributes']['checked'] );
  45          if ( $post_[$this->prefix][$this->field->form_id][$this->prefix . $this->field->settings['attributes']['name']] == $this->field->settings['attributes']['value'] ) $this->field->settings['attributes']['checked'] = 'checked';
  46  
  47          $this->attributes_filter_css();
  48      }
  49  }
  50  new MP_Form_field_type_radio( __( 'Radio Button', 'MailPress' ) );


Generated: Mon Mar 11 18:33:33 2019 Cross-referenced by PHPXref 0.7.1