addElement('text', 'title', ['required' => true, 'label' => 'Title']); $this->addElement( 'extendedFile', 'fileName', [ 'required' => true, 'label' => 'File', 'description' => 'Allowed extensions: pdf', ] ); $this->getElement('fileName')->addValidator('File_Extension', true, ['pdf']); return parent::_initElements(); } }