Upgrading from 6.3 to 7.0 - breaking change

Posted by Community Admin on 04-Aug-2018 20:15

Upgrading from 6.3 to 7.0 - breaking change

All Replies

Posted by Community Admin on 02-Jun-2014 00:00

I've read of the breaking change in the Pages API specific to multilang,

I am currently upgrading my code to the latest version and have the following

//if (pageNode.Page != null && pageNode.Page.PageLanguageLink != null) // means split-language (i.e. not sync'd) page

// loop thru each languageLink

foreach(PageData pd in pageNode.Page.PageLanguageLink.LanguageLinks)

my current code above, has anyone had to upgrade this looping of Language Page Links and how ?

thanks in advance

Posted by Community Admin on 05-Jun-2014 00:00

Hi Ernesto,

In Sitefinity 7, as you commented there are significant changes in the way to access Pages using Sitefinity  API. One of the main changes is related to the amount of records in the table sf_page_node, for instance. Previously there was a record in the table for each page translation (in Split localization strategy). Since Sitefinity 7 there is only one record for the page disregarding how many translations exist for that page.

The following article mentions most of these changes:

http://www.sitefinity.com/documentation/documentationarticles/api-changes-in-sitefinity-7.0

Although it isn't known your whole implementation or the goal of your code, keep in mind that in Sitefinity 7 the property Page in PageNode is obsolete. You will need to use GetPageData() instead. Also the fact of having only one page node disregarding the amount of translations. 

The following code snippet for instance iterates through the different page translation:

protected override void InitializeControls(GenericContainer container)
        
 
            PageManager manager = PageManager.GetManager();
             
            var pageNode = manager.GetPageNodes().Where(pn=>pn.Title=="Home").SingleOrDefault();
 
            if (pageNode != null)
                CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture;
                CultureInfo currentCulture =   Thread.CurrentThread.CurrentCulture;
 
                foreach(var culture in pageNode.AvailableCultures)
                
                    Thread.CurrentThread.CurrentUICulture =  culture;
                    Thread.CurrentThread.CurrentCulture = culture;
 
                    var pageData = pageNode.GetPageData();
                    ...
                    ...
                
 
                Thread.CurrentThread.CurrentUICulture = currentUICulture;
                Thread.CurrentThread.CurrentCulture = currentCulture;
                
            


Kind Regards,
Junior Dominguez
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 18-May-2015 00:00

I am completing a Proof of Concept to upgrade our 5.4 solution to 8.0 and have come across this exact same issue. My error message is 

'Telerik.Sitefinity.Pages.Model.PageData' does not contain a definition for 'PageLanguageLink' and no extension method 'PageLanguageLink' accepting a first argument of type 'Telerik.Sitefinity.Pages.Model.PageData' could be found (are you missing a using directive or an assembly reference?)

Obviously "PageLanguageLink" is no longer a property.  How do we get this property with the new API changes?​

Posted by Community Admin on 18-May-2015 00:00

I am completing a Proof of Concept to upgrade our 5.4 solution to 8.0 and have come across this exact same issue. My error message is 

'Telerik.Sitefinity.Pages.Model.PageData' does not contain a definition for 'PageLanguageLink' and no extension method 'PageLanguageLink' accepting a first argument of type 'Telerik.Sitefinity.Pages.Model.PageData' could be found (are you missing a using directive or an assembly reference?)


Obviously "PageLanguageLink" is no longer a property.  How do we get this property with the new API changes?​

Posted by Community Admin on 18-May-2015 00:00

going back to my code for when I had to resolve this, this is what I found

 

the commented line is what I was using prior,

and the next line what I am using today...

 

//foreach(PageData pd in pageNode.Page.PageLanguageLink.LanguageLinks)
foreach (CultureInfo pd in pageNode.GetPageData().AvailableCultures)​

 

 

 

hope this helps.

Posted by Community Admin on 18-May-2015 00:00

FYI, every time I comment on this system, my posts are flagged as spam.

Posted by Community Admin on 18-May-2015 00:00

which makes slow communication even slower...

the end.

This thread is closed