RainLab\Pages\Classes\Menu::beforeValidate PHP Method

beforeValidate() public method

Validate custom attributes.
public beforeValidate ( ) : void
return void
    public function beforeValidate()
    {
        if (!strlen($this->code)) {
            throw new ValidationException(['code' => Lang::get('rainlab.pages::lang.menu.code_required')]);
        }
        if (!preg_match('/^[0-9a-z\\-\\_]+$/i', $this->code)) {
            throw new ValidationException(['code' => Lang::get('rainlab.pages::lang.menu.invalid_code')]);
        }
    }