Esempio n. 1
0
 /**
  * Get the value of a field
  *
  * @param string $field The field's name
  * @param null $fallback
  * @return mixed 
  * @static 
  */
 public static function getValue($field, $fallback = null)
 {
     return \Former\Former::getValue($field, $fallback);
 }
Esempio n. 2
0
 /**
  * Use values stored in Former to populate the current field
  */
 private function repopulate($fallback = null)
 {
     if (is_null($fallback)) {
         $fallback = $this->value;
     }
     // Get values from POST, populated, and manually set value
     $post = Former::getPost($this->name);
     $populate = Former::getValue($this->name);
     // Assign a priority to each
     if (!is_null($post)) {
         $value = $post;
     } elseif (!is_null($populate)) {
         $value = $populate;
     } else {
         $value = $fallback;
     }
     return $value;
 }