Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 939 posts 2574 karma points
    Mar 18, 2019 @ 10:03
    Claushingebjerg
    0

    umbraco.library in v8

    Im trying to do the basic line break in multiline in a partial

    umbraco.library.ReplaceLineBreaks
    

    Like so:

    @Html.Raw(umbraco.library.ReplaceLineBreaks(item.Value("citatet")))
    

    but get an error

    Compiler Error Message: CS0103: The name 'umbraco' does not exist in the current context
    

    Has something changed in 8 or am i just missing something obvious?

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Mar 18, 2019 @ 14:41
    Sebastiaan Janssen
    101

    umbraco.library is no longer available, I think you can use @(Html.ReplaceLineBreaksForHtml(item.Value("citatet"))) instead.

  • Bjarne Fyrstenborg 1286 posts 4060 karma points MVP 8x c-trib
    Mar 18, 2019 @ 14:46
    Bjarne Fyrstenborg
    1

    As Sebastiaan says umbraco.library is no longer available or basically everything in umbraco namespace (notice the lowercase umbraco).

    Also in Umbraco v7 the umbraco.library is obsolete, where you can use Umbraco.ReplaceLineBreaks().

    In Umbraco v8 .ReplaceLineBreaks() method doesn't exists in UmbracoHelper, but is an Html extension method.

  • Claushingebjerg 939 posts 2574 karma points
    Mar 19, 2019 @ 08:23
    Claushingebjerg
    0

    Thanks guys. Is there the documentation concerning the "Html" extension method anywhere?

  • Bjarne Fyrstenborg 1286 posts 4060 karma points MVP 8x c-trib
    Mar 19, 2019 @ 08:37
    Bjarne Fyrstenborg
    2

    I am not sure if there have been Html extension methods in Umbraco previously. I think it has only been methods on UmbracoHelper. https://our.umbraco.com/Documentation/Reference/Querying/UmbracoHelper/

    But you can find the public methods in this class https://github.com/umbraco/Umbraco-CMS/blob/91c52cffc8b7c70dc956f6c6610460be2d1adc51/src/Umbraco.Web/HtmlStringUtilities.cs

  • Claushingebjerg 939 posts 2574 karma points
    Mar 19, 2019 @ 08:39
    Claushingebjerg
    0

    Thanks Bjarne

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies