Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 07:47
    Morten
    0

    umbracoNaviHide doesn't work

    All my recent projects has implemented umbracoNaviHide inside a True/False property, and they all work just fine. In my 7.6.9 upgraded project, I simply cannot get a True/False value to work.

    On my Master composition, I have a "Navigation" tab together with a True/False property. All my pages inherit through that composition.

    When I do something like:

    var menuItems = CurrentPage.Site().Children;
    
    @foreach(var item in menuItems) {
        if(item.IsVisible()) {
            <!--show element-->
        }
    }
    

    It doesn't work. It should work, as it has in all my lastest projects. Here's what I've tried:

    var menuItems = CurrentPage.Site().Children.Where("Visible");
    var menuItems = CurrentPage.Site().Children.Where("umbracoNaviHide == false"); //setting this to true gives me no results
    var menuItems = CurrentPage.Site().Children.Where(x => x.IsVisible());
    var menuItems = CurrentPage.Site().Children.Where("randomProperty == false"); //or true
    
    foreach(var item in menuItems) {
        if(!item.HasValue("umbracoNaviHide)) { <!-- show item --> }
        if(item.GetPropertyValue("umbracoNaviHide")) == "false") { <!-- show item --> }
    }
    

    I think that's all. I did update my ModelsBuilder. I did restart the project. I did remove the property and readd it. I basically tried everything, but it just won't work.

    What on earth?

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 13, 2017 @ 07:57
    Michaël Vanbrabandt
    0

    Hi Morten,

    can you just add a screenshot of your property on your composition document type?

    /Michaël

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 08:12
    Morten
    0

    Hi Michael

    Here it is: https://i.imgur.com/j2ciMsv.png

    Here is a composition inherited document type: https://i.imgur.com/CcqeVPb.png

    "Gem fra menuen" means "Hide from the menu".

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 13, 2017 @ 08:24
    Michaël Vanbrabandt
    0

    Morten,

    can you try to rename the alias of the property to something else and test this to see if the property then work in your razorcode?

    /Michaël

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 08:27
    Morten
    0

    It doesn't work. I've completely removed the tab, saved, created a new property and renamed it into "somethingRandom". Then tried with GetPropertyValue("somethingRandom") == "false" and Where("somethingRandom" == "false").

    This is so weird.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 13, 2017 @ 08:29
    Michaël Vanbrabandt
    0

    Morten,

    can you add a screenshot of the content node where you use this property?

    Also how is the modelsbuilder set? Can you add a screenshot of this ( located in the developer section ).

    /Michaël

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 08:31
    Morten
    0

    I sent you a content node screenshot that shows it has the property on it: https://i.imgur.com/CcqeVPb.png

    The ModelsBuilder is set to Dll. Here's a screenshot: https://i.imgur.com/9iruy0d.png

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 13, 2017 @ 08:36
    Michaël Vanbrabandt
    0

    Hmmm thats very weird...

    Maybe its a caching issue, can you republish your entire site and see if that helps?

    /Michaël

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 08:39
    Morten
    0

    Did multiple times and it didn't work.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 13, 2017 @ 08:40
    Michaël Vanbrabandt
    0

    One more thing that you can try out, remove the property from the composition Master document type and add it to the document type which is used for creating the content node.

    /Michaël

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 08:42
    Morten
    0

    So that only THAT one content node has it? All my content nodes inherit from a homepage content node, but not as the document type, because I don't want them to inherit using nested inheritage.

    So you want me to add the umbracoNaviHide property to a single node, such as the homepage I have?

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 13, 2017 @ 08:47
    Michaël Vanbrabandt
    0

    Correct, to test that the issue is not related to the composition inheritance.

    /Michaël

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 08:51
    Morten
    0

    I cannot get that to work either.

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 08:59
    Morten
    0

    Weird, I don't think my reply went through.

    Nope, I cannot get that to work either.

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 09:13
    Morten
    0

    Okay this is soooooooooooooooooooooooooooooooooooo weird. Take a look at this:

    @foreach(var item in menuItems) {
        <p>@item.GetPropertyValue("umbracoNaviHide") - @item.Name</p>
    }
    

    This gives me the following:

    FALSE - Our offers
    FALSE - Technology
    TRUE - Projects
    FALSE - About us
    FALSE - Gallery
    TRUE - Contact
    

    However, this is how the umbracoNaviHide is setup in the backoffice:

    Ticked - Our offers
    Not ticked - Technology
    Ticked - Projects
    Not ticked - About us
    Not ticked - Gallery
    Ticked - Contact
    

    How the flying hell is this possible?

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 13, 2017 @ 09:16
    Michaël Vanbrabandt
    0

    Can you remove the xml file from the app_data folder which contains all the data of your content and republish your site?

    /Michaël

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 09:21
    Morten
    0

    App_Data or its child folders does not contain any XML files (except an empty one inside \TEMP\ClientDependency).

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 09:24
    Morten
    0

    Also, if I change Our offers's property to not ticked, it still remains as FALSE. If I do the same for Technology it changes between FALSE and TRUE.

    I'm 100% sure at this point, that I'm encountering a bug.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 13, 2017 @ 09:26
    Michaël Vanbrabandt
    0

    Sry I mean the App_Data/umbraco.config file, thats the file which contains all content details.

    /Michaël

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 09:30
    Morten
    0

    Ah yeah, I did that now and it didn't change anything, unfortunately. The newly generated file is the exact same as the old.

  • Morten 105 posts 345 karma points
    Oct 13, 2017 @ 09:50
    Morten
    0

    Okay our.Umbraco.org is acting up right now. Most of my replies aren't appearing on the page. Keep the replies as single replies, not as nested replies.

    I removed the file, republished the site, and compared the two files. They're identical. Completely identical.

  • Benoit Cornette 29 posts 169 karma points
    Nov 03, 2017 @ 16:07
    Benoit Cornette
    0

    Hi Morten,

    Can you try this?

    @ { 
        var site = Model.Content.Site(); 
        var selection = site.Children.Where(x => x.IsVisible()).ToArray();
    }
    

    After that a foreach as usual...

    Not with currentPage but with Model. Just giving it a shot, it's a strange problem but you never know...

    Kind regards,

    Benoit

  • David Parr 48 posts 206 karma points
    Nov 03, 2017 @ 17:11
    David Parr
    0

    It sounds like a caching issue and indexes not being rebuilt. Remove App_Data/umbraco.config and/or try rebuilding from the backoffice.

Please Sign in or register to post replies

Write your reply to:

Draft