skeeks\cms\traits\ValidateRulesTrait::validateCode PHP Method

validateCode() public method

public validateCode ( $attribute )
    public function validateCode($attribute)
    {
        if (!preg_match('/^[a-zA-Z]{1}[a-zA-Z0-9-]{1,255}$/', $this->{$attribute})) {
            $this->addError($attribute, \Yii::t('skeeks/cms', 'Use only letters of the alphabet in lower or upper case and numbers, the first character of the letter (Example {code})', ['code' => 'code1']));
        }
    }