GcFrontend\Form\Install::lang PHP Method

lang() public method

Language form
public lang ( array $config ) : void
$config array Configuration
return void
    public function lang($config)
    {
        $lang = new Element\Select('lang');
        $lang->setAttribute('size', 10)->setValueOptions($config['locales'])->setValue('en_GB')->setAttribute('class', 'form-control');
        $inputFilter = $this->getInputFilter();
        $inputFilter->add(array('name' => 'lang', 'required' => true, 'validators' => array(array('name' => 'not_empty'))), 'lang');
        $this->add($lang);
    }

Usage Example

Example #1
0
 /**
  * Select language in first page
  *
  * @return array
  */
 public function indexAction()
 {
     $this->checkInstall(1);
     $this->installForm->lang($this->getServiceLocator()->get('Config'));
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost()->toArray();
         $this->installForm->setData($postData);
         if ($this->installForm->isValid()) {
             $session = $this->getSession();
             $session['install'] = array('lang' => $this->installForm->getInputFilter()->getValue('lang'));
             return $this->redirect()->toRoute('install/license');
         }
     }
     $this->layout()->setVariables(array('currentRoute' => $this->getRouteMatch()->getMatchedRouteName()));
     return array('form' => $this->installForm);
 }
All Usage Examples Of GcFrontend\Form\Install::lang