/**
  * @uses EventPreSaveFilter
  */
 public function setDefaultValues(&$context)
 {
     if (!isset($context['event']->eDefaultValues) || !is_array($context['event']->eDefaultValues)) {
         return;
     }
     // Create a Datasource class, which has the logic for finding Parameters
     // and turning them into the values.
     $datasource = new Datasource(null, false);
     // Fake an environment to find Parameters in
     $env = array('env' => Frontend::instance()->Page()->Env(), 'param' => Frontend::instance()->Page()->Params());
     // Loop over the Default Values, setting them in $_POST or `$context['fields']`
     // as appropriate.
     foreach ($context['event']->eDefaultValues as $field => $dv) {
         $value = $datasource->__processParametersInString($dv['value'], $env);
         // Custom field, this will set $_POST instead of the `$context['fields']`
         // as `$context['fields']` only contains things inside $_POST['fields']
         if ($dv['custom'] == 'yes') {
             $matches = preg_split('/\\[/U', $field);
             foreach ($matches as $key => $match) {
                 $matches[$key] = trim($match, ']');
             }
             if (count($matches) == 1) {
                 self::setArrayValue($_POST, $field, $value, $dv['override'] == 'yes');
             } else {
                 $tree = self::addKey($matches, $value);
                 // If the DV is an override, set it regardless
                 // DV is not an override, so only set if it hasn't already been set
                 if ($dv['override'] == 'no' && !self::checkArrayForTree($_POST, $tree)) {
                     $_POST = array_merge_recursive($_POST, $tree);
                 } else {
                     if ($dv['override'] == 'yes') {
                         $_POST = array_replace_recursive($_POST, $tree);
                     }
                 }
             }
             continue;
         }
         self::setArrayValue($_POST['fields'], $field, $value, $dv['override'] == 'yes');
         self::setArrayValue($context['fields'], $field, $value, $dv['override'] == 'yes');
     }
 }