/** * Override function to add hidden attribute to store linked sample id * When adding a survey 1 record this is given the value 0 * When adding a survey 2 record this is given the sample_id of the corresponding survey 1 record. * @param type $args * @param type $auth * @param type $attributes * @return string The hidden inputs that are added to the start of the form */ protected static function getFirstTabAdditionalContent($args, $auth, &$attributes) { $r = parent::getFirstTabAdditionalContent($args, $auth, $attributes); $linkAttr = 'smpAttr:' . $args['survey_1_attr']; if (array_key_exists('new', $_GET)) { if (array_key_exists('sample_id', $_GET)) { // Adding a survey 2 record $r .= '<input id="' . $linkAttr . '" type="hidden" name="' . $linkAttr . '" value="' . $_GET['sample_id'] . '"/>' . PHP_EOL; } else { // Adding a survey 1 record $r .= '<input id="' . $linkAttr . '" type="hidden" name="' . $linkAttr . '" value="0"/>' . PHP_EOL; } } return $r; }