We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38850
    • 110 Posts
    I need some help finding this.

    When you create a new Resource and are editing the resource fields for the first time, there is no frozen URI text. In other words, if you select that checkbox, the text box that appears is empty, waiting for you to type a URI.

    However, once you save the resource for the first time, if you now check the frozen URI box, MODX has generated a URI for you that is already in the text field.

    My question is this, can I access the method that generates the URI so I can do this myself? I have been looking high and low and searching source files and API and docs and Google but cannot find how/where MODX generates this URI. I have my reasons for wanting to do this, but say for example there is a custom URI in there but I just want to go back to the default version, or maybe just "see what it would be if MODX created it" etc etc.

    The closest I've found is the resource method "cleanAlias" but this only generates a sanitized alias based on the resource title field.
    I need to generate the URI pretty much the same way MODX would which takes into account FURLS and whether to use container paths in the URI.
    I also found a method "refreshURIs" in the modresource object. This doesn't seem to work on a new resource which hasn't been saved yet because I get a PHP error about working on a "non object".

    Any help would be appreciated!
      • 29661
      • 116 Posts
      Hi,

      I think it's modResource->getAliasPath.

      As it is used in modResourceCreateProcessor...
        --
        John
        @theboxer