コード例 #1
0
 private function _initConfigsForm($section, $namespace, $configs = array(), $posts = null)
 {
     if (self::$configForm === null) {
         self::$configForm = new Application_Form_AutoConfigs($configs);
         self::$configForm->setAction($this->_helper->url->url(array('action' => 'save', 'controller' => 'config'), 'default', false));
         if ($posts !== null && is_array($posts)) {
             self::$configForm->setDefaults($posts);
         }
         foreach (self::$configForm->getElements() as $key => $element) {
             // plugins prepare known elements
             X_VlcShares_Plugins::broker()->prepareConfigElement($section, $namespace, $key, $element, self::$configForm, $this);
         }
         if ($posts !== null && is_array($posts)) {
             // reset errors
             //self::$configForm->setErrors(array());
             self::$configForm->isValid($posts);
         }
     }
     /*
     if ( $posts !== null && is_array($posts)  ) {
     	$this->configForm->isValid($posts);
     }
     */
     return self::$configForm;
 }
コード例 #2
0
 private function _initConfigsForm($section, $namespace, $configs = array(), $posts = null)
 {
     if (self::$configForm === null) {
         self::$configForm = new Application_Form_AutoConfigs($configs);
         /*
         if ( $posts !== null && is_array($posts)  ) {
         	self::$configForm->setDefaults($posts);
         }
         */
         if ($section == 'general' || $section == 'helpers' || $section == 'vlc') {
             // call general handler
             $this->prepareGeneralElementsForm(self::$configForm);
         } else {
             foreach (self::$configForm->getElements() as $key => $element) {
                 // plugins prepare known elements
                 X_VlcShares_Plugins::broker()->prepareGConfigsElement($section, $namespace, $key, $element, self::$configForm, $this);
             }
         }
         if ($posts !== null && is_array($posts)) {
             self::$configForm->isValid($posts);
             foreach (self::$configForm->getElements() as $key => $element) {
                 // after isValid, plugin triggered for check GConfigs elements
                 X_VlcShares_Plugins::broker()->checkGConfigsElement($section, $namespace, $key, $element, self::$configForm, @$posts[$key], $this);
             }
         }
     }
     return self::$configForm;
 }