Пример #1
0
 /**
  * Fetch a field value from both the new and old POST array
  *
  * @param string $name A field name
  * @param string $fallback A fallback if nothing was found
  * @return string The results
  * @static 
  */
 public static function getPost($name, $fallback = null)
 {
     return \Former\Former::getPost($name, $fallback);
 }
Пример #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;
 }