예제 #1
0
 function addChild(WFView $view)
 {
     if (!$view instanceof WFPassword) {
         throw new WFException("Only WFPassword child views are accepted.");
     }
     if ($this->confirmPasswordId !== NULL) {
         throw new WFException("WFPassword accepts only one child.");
     }
     $this->confirmPasswordId = $view->id();
     $this->setValueForKey(false, 'autocomplete');
     $view->setValueForKey(false, 'autocomplete');
     return parent::addChild($view);
 }
예제 #2
0
 /**
  *  To implement our prototype functionality, we need to detect when a child object named "<id>Prototype" has been added.
  *
  *  If a prototype object is detected, we set up the prototype for the WFDynamic.
  *
  *  @param object WFView The object being added.
  */
 function addChild(WFView $view)
 {
     if ($view->id() == "{$this->id}Prototype") {
         $this->setPrototype($view);
     } else {
         // add new view to the "parentView" object
         $parentView = $this->calculateParent();
         if ($parentView) {
             $parentView->addChild($view);
         } else {
             parent::addChild($view);
         }
     }
 }
예제 #3
0
파일: WFForm.php 프로젝트: apinstein/phocoa
 function addChild(WFView $view)
 {
     parent::addChild($view);
     if ($view instanceof WFSubmit) {
         $this->numberOfSubmitButtons++;
         // if if the FIRST one, save it; otherwise,
         if ($this->calculatedDefaultSubmitID === WFForm::CALCULATED_DEFAULT_SUBMIT_ID_NONE) {
             $this->calculatedDefaultSubmitID = $view->id();
         } else {
             if (!$this->defaultSubmitID) {
                 $this->calculatedDefaultSubmitID = WFForm::CALCULATED_DEFAULT_SUBMIT_ID_CANNOT_DETERMINE;
                 WFLog::log("Form id: '{$this->id}' is unable to determine the default button for the form. You should set one via defaultSubmitID to avoid errors in some browsers.", WFLog::WARN_LOG);
             }
         }
     }
 }
예제 #4
0
 function addChild($newChild)
 {
     parent::addChild($newChild);
     // make sure one child is always selected
     if (!$this->selectedRadio and !$newChild instanceof WFDynamic) {
         $this->setSelectedRadio($newChild);
     }
 }