OEModule\OphCiExamination\models\Element_OphCiExamination_DRGrading::flagRequired PHP Method

flagRequired() public method

validator that requires the attribute only if the flag attribute on the element is true.
public flagRequired ( $attribute, $params )
$attribute
$params
    public function flagRequired($attribute, $params)
    {
        $flag = $params['flag'];
        if ($this->{$flag} && $this->{$attribute} == null) {
            $this->addError($attribute, $this->getAttributeLabel($attribute) . ' is required');
        }
    }