Exemplo n.º 1
0
    /// <summary>
    /// Creates new version of the object. Called when the "Ensure version" button is pressed.
    /// Expects the CreateVersionedObject method to be run first.
    /// </summary>
    private bool EnsureVersion()
    {
        // Get the css stylesheet
        CssStylesheetInfo stylesheet = CssStylesheetInfoProvider.GetCssStylesheetInfo("MyNewVersionedStylesheet");

        if (stylesheet != null)
        {
            // Check if object versioning of stylesheet objects is allowed on current site
            if (ObjectVersionManager.AllowObjectVersioning(stylesheet, CMSContext.CurrentSiteName))
            {
                // Ensure version
                ObjectVersionManager.EnsureVersion(stylesheet, false);

                return(true);
            }
        }

        return(false);
    }