7 votes

Razor Components

Helper extensions for razor support in Umbraco 4.x

This Library adds 2 new features to RazorLibraryCore (@Library.XXX())

1. RenderMacro

RenderMacro has 2 modes;

First can be called using

@Library.RenderMacro("MacroAlias", new { stringProp = "value", numberProp= 199, boolProp=true})

this will render a named macro from the back office.

Second can be called with a path to a razor macro script in the form

@Library.RenderMacro("~/macroScripts/scriptFile.cshtml", new { Property1 = "value", Prop2= "value2"})

this doesn't need to have been registered in the back office to work.

2. ImageUrl/ImageUrls

This call can be used to retrieve a one or more crop urls form a media picker property (also supports DAMP and embedded media xml)

@Library.ImageUrl("imagePropertyAlias", "aliasOfCropPropertyOnMediaNode", "cropName")

this calls falls back to using the umbracoFile property if needs must.

How to use

add @using Tocsoft.Umbraco.RazorComponents to the top of your razor file and you will then be able to use the helper methods.

Compatibility

This is compatible with normal Umbraco Razor macros an also from within views using the UmbraMVCo library

 

Screenshots

Package owner

Scott Williams

Scott Williams

Scott has 71 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
8.3.x (untested)
8.2.x (untested)
8.1.x (untested)
8.0.x (untested)
7.15.x (untested)
7.14.x (untested)
7.13.x (untested)
7.12.x (untested)
7.11.x (untested)
7.10.x (untested)
7.9.x (untested)
7.8.x (untested)
7.7.x (untested)
7.6.x (untested)
7.5.x (untested)
7.4.x (untested)
7.3.x (untested)
7.2.x (untested)
7.1.x (untested)
7.0.x (untested)
6.1.x (untested)
6.0.x (untested)

You must login before you can report on package compatibility.

Package Information

  • Package owner: Scott Williams
  • Created: 19/06/2012
  • Current version 1.1
  • License MIT
  • Downloads: 2551