_requiredCsvFields = (array)$options['requiredCsvFields']; } return $this; } protected function _initElements() { $this->addElement( 'extendedFile', 'csvFile', array( 'label' => 'CSV File (.csv):', 'required' => true, 'validators' => array(new \Zend_Validate_File_Extension('csv')), 'description' => 'Required columns: ' . implode(', ', array_map('strtoupper', $this->_requiredCsvFields)), ) ); /** @var \Qs_Form_Element_ExtendedFile $fileElement */ $fileElement = $this->getElement('csvFile'); /** @var \App_Doc_Admin $doc */ $fileElement->getTransferAdapter()->addFilter( 'Rename', \App\User\Import\View::getFullImportFolderPath() ); $this->addElementPrefixPath('App\User\Import\Validate', 'App/User/Import/Validate', 'validate'); $fileElement->addValidator('CsvFile', false, array('requiredCsvFields' => $this->_requiredCsvFields)); return parent::_initElements(); } protected function _initButtons() { parent::_initButtons(); $this->getElement('btnSubmit')->setLabel('Import'); return $this; } }