コード例 #1
0
ファイル: AModel.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Check dependency
  *
  * @param \XLite\View\FormField\AFormField $field Field
  *
  * @return boolean
  */
 protected function checkDependency($field)
 {
     $dependency = $field->getParam(\XLite\View\FormField\AFormField::PARAM_DEPENDENCY);
     $result = true;
     foreach ($dependency as $depType => $dependencies) {
         foreach ($dependencies as $depField => $depValue) {
             if (static::DEPENDENCY_SHOW == $depType) {
                 if ($this->checkRequestHasExpectedValue($depField, $depValue)) {
                     if (false !== $result) {
                         $result = true;
                     }
                 } else {
                     $result = false;
                 }
             } else {
                 if ($this->checkRequestHasExpectedValue($depField, $depValue)) {
                     $result = false;
                 } else {
                     if (false !== $result) {
                         $result = true;
                     }
                 }
             }
         }
     }
     return $result;
 }