public function setConditionalMeta()
    {
        foreach ($this->__conditions as $objCondition) {
            $blnResult = $objCondition->isMet();

            switch ($objCondition->getProperty()) {
                case "visible":
                    // This can be applied on all sorts of subjects.
                    if ($blnResult) {
                        if ($objCondition->getValue()) {
                            $this->setMeta("style", "display: block;");
                        } else {
                            $this->setMeta("style", "display: none;");
                        }
                    } else {
                        if ($objCondition->getValue()) {
                            $this->setMeta("style", "display: none;");
                        } else {
                            $this->setMeta("style", "display: block;");
                        }
                    }
                    // Continueing to the required property.
                case "required":
                    // This can only be applied on all subjects except for Paragraphs
                    if (get_class($objCondition->getSubject()) !== "ValidFormBuilder\\Paragraph") {
                        if ($blnResult) {
                            if ($objCondition->getValue()) {
                                if (get_class($this) !== "ValidFormBuilder\\Fieldset") {
                                    // TODO Disabled because it messes up multifields.
                                    // $this->setMeta("class", "vf__required", true);
                                }
                            } else {
                                if (get_class($this) !== "ValidFormBuilder\\Fieldset") {
                                    // TODO Disabled because it messes up multifields.
                                    // $this->setMeta("class", "vf__optional", true);
                                }
                            }
                        } else {
                            if ($objCondition->getValue()) {
                                if (get_class($this) !== "ValidFormBuilder\\Fieldset") {
                                    // TODO Disabled because it messes up multifields.
                                    // $this->setMeta("class", "vf__optional", true);
                                }
                            } else {
                                if (get_class($this) !== "ValidFormBuilder\\Fieldset") {
                                    // TODO Disabled because it messes up multifields.
                                    // $this->setMeta("class", "vf__required", true);
                                }
                            }
                        }
                    }

                    break;
                case "enabled":
                    // This can only be applied on all subjects except for Paragraphs and Groups
                    if (get_class($objCondition->getSubject()) !== "ValidFormBuilder\\Paragraph"
                            && get_class($objCondition->getSubject()) !== "ValidFormBuilder\\Group") {
                        if ($blnResult) {
                            if ($objCondition->getValue()) {
                                $this->setFieldMeta("disabled", "", true);
                            } else {
                                $this->setFieldMeta("disabled", "disabled", true);
                            }
                        } else {
                            if ($objCondition->getValue()) {
                                $this->setFieldMeta("disabled", "disabled", true);
                            } else {
                                $this->setFieldMeta("disabled", "", true);
                            }
                        }
                    }

                    break;
            }
        }
    }
public function setConditionalMeta()
    {
        foreach ($this->__conditions as $objCondition) {
            $blnResult = $objCondition->isMet();

            switch ($objCondition->getProperty()) {
                case "visible":
                    // This can be applied on all sorts of subjects.
                    if ($blnResult) {
                        if ($objCondition->getValue()) {
                            $this->setMeta("style", "display: block;");
                        } else {
                            $this->setMeta("style", "display: none;");
                        }
                    } else {
                        if ($objCondition->getValue()) {
                            $this->setMeta("style", "display: none;");
                        } else {
                            $this->setMeta("style", "display: block;");
                        }
                    }
                    // Continueing to the required property.
                case "required":
                    // This can only be applied on all subjects except for Paragraphs
                    if (get_class($objCondition->getSubject()) !== "ValidFormBuilder\\Paragraph") {
                        if ($blnResult) {
                            if ($objCondition->getValue()) {
                                if (get_class($this) !== "ValidFormBuilder\\Fieldset") {
                                    // TODO Disabled because it messes up multifields.
                                    // $this->setMeta("class", "vf__required", true);
                                }
                            } else {
                                if (get_class($this) !== "ValidFormBuilder\\Fieldset") {
                                    // TODO Disabled because it messes up multifields.
                                    // $this->setMeta("class", "vf__optional", true);
                                }
                            }
                        } else {
                            if ($objCondition->getValue()) {
                                if (get_class($this) !== "ValidFormBuilder\\Fieldset") {
                                    // TODO Disabled because it messes up multifields.
                                    // $this->setMeta("class", "vf__optional", true);
                                }
                            } else {
                                if (get_class($this) !== "ValidFormBuilder\\Fieldset") {
                                    // TODO Disabled because it messes up multifields.
                                    // $this->setMeta("class", "vf__required", true);
                                }
                            }
                        }
                    }

                    break;
                case "enabled":
                    // This can only be applied on all subjects except for Paragraphs and Groups
                    if (get_class($objCondition->getSubject()) !== "ValidFormBuilder\\Paragraph"
                            && get_class($objCondition->getSubject()) !== "ValidFormBuilder\\Group") {
                        if ($blnResult) {
                            if ($objCondition->getValue()) {
                                $this->setFieldMeta("disabled", "", true);
                            } else {
                                $this->setFieldMeta("disabled", "disabled", true);
                            }
                        } else {
                            if ($objCondition->getValue()) {
                                $this->setFieldMeta("disabled", "disabled", true);
                            } else {
                                $this->setFieldMeta("disabled", "", true);
                            }
                        }
                    }

                    break;
            }
        }
    }
public function setConditionalMeta ( ) { foreach ( $ this -> __conditions as $ objCondition ) { $ blnResult = $ objCondition -> isMet ( ) ; switch ( $ objCondition -> getProperty ( ) ) { case "visible" : // This can be applied on all sorts of subjects. if ( $ blnResult ) { if ( $ objCondition -> getValue ( ) ) { $ this -> setMeta ( "style" , "display: block;" ) ; } else { $ this -> setMeta ( "style" , "display: none;" ) ; } } else { if ( $ objCondition -> getValue ( ) ) { $ this -> setMeta ( "style" , "display: none;" ) ; } else { $ this -> setMeta ( "style" , "display: block;" ) ; } } // Continueing to the required property. case "required" : // This can only be applied on all subjects except for Paragraphs if ( get_class ( $ objCondition -> getSubject ( ) ) !== "ValidFormBuilder\\Paragraph" ) { if ( $ blnResult ) { if ( $ objCondition -> getValue ( ) ) { if ( get_class ( $ this ) !== "ValidFormBuilder\\Fieldset" ) { // TODO Disabled because it messes up multifields. // $this->setMeta("class", "vf__required", true); } } else { if ( get_class ( $ this ) !== "ValidFormBuilder\\Fieldset" ) { // TODO Disabled because it messes up multifields. // $this->setMeta("class", "vf__optional", true); } } } else { if ( $ objCondition -> getValue ( ) ) { if ( get_class ( $ this ) !== "ValidFormBuilder\\Fieldset" ) { // TODO Disabled because it messes up multifields. // $this->setMeta("class", "vf__optional", true); } } else { if ( get_class ( $ this ) !== "ValidFormBuilder\\Fieldset" ) { // TODO Disabled because it messes up multifields. // $this->setMeta("class", "vf__required", true); } } } } break ; case "enabled" : // This can only be applied on all subjects except for Paragraphs and Groups if ( get_class ( $ objCondition -> getSubject ( ) ) !== "ValidFormBuilder\\Paragraph" && get_class ( $ objCondition -> getSubject ( ) ) !== "ValidFormBuilder\\Group" ) { if ( $ blnResult ) { if ( $ objCondition -> getValue ( ) ) { $ this -> setFieldMeta ( "disabled" , "" , true ) ; } else { $ this -> setFieldMeta ( "disabled" , "disabled" , true ) ; } } else { if ( $ objCondition -> getValue ( ) ) { $ this -> setFieldMeta ( "disabled" , "disabled" , true ) ; } else { $ this -> setFieldMeta ( "disabled" , "" , true ) ; } } } break ; } } }
Based on which conditions are met, corresponding metadata is set on the object.
Based on which conditions are met corresponding metadata is set on the object .