+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Upgrading from 6.3 to 7.0 - breaking change

Upgrading from 6.3 to 7.0 - breaking change

7 posts, 0 answered
  1. readonlychild
    readonlychild avatar
    67 posts
    Registered:
    26 May 2011
    02 Jun 2014
    Link to this post

    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

  2. Junior Dominguez
    Junior Dominguez avatar
    115 posts
    Registered:
    02 Dec 2016
    05 Jun 2014
    Link to this post
    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
     
  3. Jared
    Jared avatar
    122 posts
    Registered:
    04 Apr 2013
    18 May 2015 in reply to Junior Dominguez
    Link to this post

    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?​

  4. Jared
    Jared avatar
    122 posts
    Registered:
    04 Apr 2013
    18 May 2015
    Link to this post

    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?​

  5. readonlychild
    readonlychild avatar
    67 posts
    Registered:
    26 May 2011
    18 May 2015
    Link to this post

    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.

  6. readonlychild
    readonlychild avatar
    67 posts
    Registered:
    26 May 2011
    18 May 2015
    Link to this post
    FYI, every time I comment on this system, my posts are flagged as spam.
  7. readonlychild
    readonlychild avatar
    67 posts
    Registered:
    26 May 2011
    18 May 2015
    Link to this post

    which makes slow communication even slower...

    the end.

7 posts, 0 answered