public function getContentRules()
    {
        if (!$this->contentAttribute) {
            return [];
        }
        $rules = [];
        $rules[] = [$this->contentAttribute, 'required'];
        if ($this->contentAttributeRule) {
            if (is_string($this->contentAttributeRule)) {
                $this->contentAttributeRule = [$this->contentAttributeRule];
            }
            if (is_array($this->contentAttributeRule)) {
                $rules[] = array_merge([$this->contentAttribute], $this->contentAttributeRule);
            }
        }

        if (!$this->contentTypeAttribute) {
            return $rules;
        }

        if (is_array($this->contentTypes) && !empty($this->contentTypes)) {
            $rules[] = [[
                $this->contentTypeAttribute],
                'required'];
            $rules[] = [[
                $this->contentTypeAttribute],
                'in',
                'range' => array_keys($this->contentTypes)];
        }
        return $rules;
    }
public function getContentRules()
    {
        if (!$this->contentAttribute) {
            return [];
        }
        $rules = [];
        $rules[] = [$this->contentAttribute, 'required'];
        if ($this->contentAttributeRule) {
            if (is_string($this->contentAttributeRule)) {
                $this->contentAttributeRule = [$this->contentAttributeRule];
            }
            if (is_array($this->contentAttributeRule)) {
                $rules[] = array_merge([$this->contentAttribute], $this->contentAttributeRule);
            }
        }

        if (!$this->contentTypeAttribute) {
            return $rules;
        }

        if (is_array($this->contentTypes) && !empty($this->contentTypes)) {
            $rules[] = [[
                $this->contentTypeAttribute],
                'required'];
            $rules[] = [[
                $this->contentTypeAttribute],
                'in',
                'range' => array_keys($this->contentTypes)];
        }
        return $rules;
    }
public function getContentRules ( ) { if ( ! $ this -> contentAttribute ) { return [ ] ; } $ rules = [ ] ; $ rules [ ] = [ $ this -> contentAttribute , 'required' ] ; if ( $ this -> contentAttributeRule ) { if ( is_string ( $ this -> contentAttributeRule ) ) { $ this -> contentAttributeRule = [ $ this -> contentAttributeRule ] ; } if ( is_array ( $ this -> contentAttributeRule ) ) { $ rules [ ] = array_merge ( [ $ this -> contentAttribute ] , $ this -> contentAttributeRule ) ; } } if ( ! $ this -> contentTypeAttribute ) { return $ rules ; } if ( is_array ( $ this -> contentTypes ) && ! empty ( $ this -> contentTypes ) ) { $ rules [ ] = [ [ $ this -> contentTypeAttribute ] , 'required' ] ; $ rules [ ] = [ [ $ this -> contentTypeAttribute ] , 'in' , 'range' => array_keys ( $ this -> contentTypes ) ] ; } return $ rules ; }
Get the rules associated with `content` and `contentType` attributes.
@return array rules.
Get the rules associated with content and contentType attributes .