public function makeSubformPart($baseSubForm, $idx = null, $values = null) { if (!is_arrayish($this->tpl_fields)) { return $baseSubForm; } if ($idx !== null) { #Existing data, value to be replaced in __toString $baseSubForm = str_replace($this->cnt_tpl, $idx, $baseSubForm); } else { #Subform template - all values to be null foreach ($this->tpl_fields as $inp_fld) { $valkey = $this->fieldValueTemplate($inp_fld); $baseSubForm = str_replace($valkey, '', $baseSubForm); } } $tpl = new PkHtmlRenderer(); $tpl[] = "\n"; if ($values === null) { //Invisible template part $js_template_tag = $this->js_template_tag; $tpl->{$js_template_tag}(RENDEROPEN, $this->js_template_attributes); } //$tpl->div(RENDEROPEN,$this->templatable_attributes); $tpl->div(RENDEROPEN, $this->deletable_dataset_attributes); foreach ($this->tpl_fields as $inp_fld) { $valkey = $this->fieldValueTemplate($inp_fld); $val = keyVal($inp_fld, $values); //if (is_string($val)) $val = "'".$val."'"; $baseSubForm = str_replace($valkey, $val, $baseSubForm); } $tpl[] = $baseSubForm . "\n"; $delete_button_tag = $this->delete_button_tag; $delete_button_wrap_tag = $this->delete_button_wrap_tag; $tpl->{$delete_button_wrap_tag}(RENDEROPEN, $this->delete_button_wrap_attributes); $tpl->{$delete_button_tag}($this->delete_button_label, $this->delete_button_attributes); $tpl->RENDERCLOSE(); $tpl->RENDERCLOSE(); if ($values === null) { //Invisible template part $tpl->RENDERCLOSE(); } $tpl[] = "\n"; return $tpl; }
#To put the Delete button in a row $diagsf->append_atts('delete_button_wrap', 'col-xs-3'); #To put the Delete button in a row $diagsf->append_atts('js_template', ['class' => 'tst-add-class-arr']); $diagsf->subform_data = $diagrows; $diagsf->hidden('id'); //$diagsf->text('diagnosiscode_id'); $diagsf->select('diagnosiscode_id', DiagnosisRef::getSelectList(true, true)); $out[] = PkForm::model($client); $infoout->wrap(['value' => PkForm::text('fname', null, ['placeholder' => 'First Name']), 'raw' => true, 'label' => 'Client First Name', 'labelAttributes' => 'block tpm-label', 'valueAttributes' => 'block tpm-value', 'wrapperAttributes' => 'col-xs-4 tpm-wrapper']); #Note arguement 'true' to ::getRefArr(true) - prepends null=>'None' to array $infoout->wrap(['value' => PkForm::select('insurance_status_id', App\References\InsuranceStatusRef::getRefArr(true), null), 'raw' => true, 'label' => 'Insurance Status', 'labelAttributes' => 'block tpm-label', 'valueAttributes' => 'block tpm-value', 'wrapperAttributes' => 'col-xs-4 tpm-wrapper']); $out[] = $infoout; $out[] = $diagsf; #Can put sections/containers together in a row $out->div(RENDEROPEN, 'row'); $out->rawdiv($diagwrapper, 'col-sm-6'); $out->rawdiv($payout, 'col-sm-6'); $out->RENDERCLOSE(); $out[] = PkForm::button('Submit', ['type' => 'submit', 'name' => 'submit', 'value' => 'submit', 'class' => 'pkmvc-button block fullwidth', 'title' => "Save Changes"]); $out[] = PkForm::close(); ?> @extends('app') @section('content') <div class='template type'> <h1>The Client Edit Template</h1> <?php echo $out; ?>