[ Index ]

MailPress 544

[ 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      var $order    = 50;
  10  
  11  	function submitted($field)
  12      {
  13          $value = (isset($_POST[$this->prefix][$field->form_id][$this->prefix . $field->settings['attributes']['name']])) ? $_POST[$this->prefix][$field->form_id][$this->prefix . $field->settings['attributes']['name']] : false;
  14  
  15          $required     = (isset($field->settings['controls']['required']) && $field->settings['controls']['required']);
  16          $empty     = ($value === false) ? true : false;
  17  
  18          if ($required && $empty)
  19          {
  20              $field->submitted['on_error'] = 1;
  21              return $field;
  22          }
  23  
  24          if ($value === $field->settings['attributes']['value'])
  25          {
  26              $field->submitted['value'] = $value;
  27              $field->submitted['text']  = sprintf(__('"%1$s" checked', MP_TXTDOM), $value);
  28              return $field;
  29          }
  30  
  31          return $field;
  32      }
  33  
  34  	function attributes_filter($no_reset)
  35      {
  36          if (!$no_reset) return;
  37  
  38          unset($this->field->setting['attributes']['checked']);
  39          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';
  40  
  41          $this->attributes_filter_css();
  42      }
  43  }
  44  new MP_Form_field_type_radio(__('Radio Button', MP_TXTDOM));


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1