/** * Get related Validation instance or create it * * @return Validation */ public function validation() { if (empty($this->validation)) { $this->validation = Validation::factory($this->name); //, $this); } return $this->validation; } /** * Get related Form instance or create it * * @return Form */ public function form() { if (empty($this->form)) { $this->form = Form::factory($this->name); //, $this); } return $this->form; }
To be honest, this doesn't make sense. ViewModels and Models are completely different: ViewModels are about preparing data for a template and seperating the view logic from the controller or view where it shouldn't be. Models are about CRUD operations on data.Good job on the fieldset class it makes life a lot easier. Just thinking about how to enable the set_form_fields call to also accommodate the new viewmodel class so it can appear in either model or viewmodel.
I thought it was to add another layer to views.
The way I understood it was a ViewModel was an additional place to build stuff to display in the View
Did you also do anything about controlling the layout ie. the ability to add a <br /> at the end of the <input blah blah><br /> or enclose the <label> <input> in a <p> </p> as I didn't see how I could achieve that when I last looked at the code.
return array( //'required_mark' => '<span class="required">*</span>', 'field_template' => '{label}{field}<br />', 'multi_field_template' => '{label}{field}<br />' );
It looks like you're new here. If you want to get involved, click one of these buttons!