Class ParagraphViewModel
- Namespace
- Dynamicweb.Frontend
- Assembly
- Dynamicweb.dll
ParagraphViewModel represents the rendering context used when a paragraph is rendered.
public class ParagraphViewModel : ViewModelBase
- Inheritance
-
ParagraphViewModel
- Inherited Members
- Extension Methods
Remarks
Contains rendering context information of the rendering Paragraph
Constructors
ParagraphViewModel()
public ParagraphViewModel()
Properties
ColorScheme
Gets the color scheme.
public ColorSchemeViewModel? ColorScheme { get; set; }
Property Value
- ColorSchemeViewModel
The color scheme as an ColorSchemeViewModel.
Container
Gets the name of the content placeholder where this paragraph is located.
public string? Container { get; set; }
Property Value
- string
The name of the container, e.g. 'myContainer'.
Remarks
If the container does not exist in the layout currently being rendered, the paragraph is rendered to the default placeholder
ContainerCount
Gets the total count of paragraphs under the content placeholder where this paragraph is located.
public int ContainerCount { get; set; }
Property Value
- int
A number indicating how many paragraphs are rendered in the container
- See Also
ContainerSettings
Gets the content placeholder settings. The settings from the layout template where this container is defined.
public IDictionary<string, string> ContainerSettings { get; set; }
Property Value
- IDictionary<string, string>
The container settings as an IDictionary<TKey, TValue> where TKey and TValue are both string.
- See Also
ContainerSort
Gets the sort order of this paragraph under the current content placeholder.
public int ContainerSort { get; set; }
Property Value
- int
A number starting from 1 that represents this paragraphs sort in the current content placeholder
Remarks
Can potentially be a negative integer.
- See Also
GridColumnNumber
Gets the position of this paragraph in the current grid row.
public int GridColumnNumber { get; set; }
Property Value
- int
The grid column number, e.g. 2 (out of 3)
GridColumnWidth
Gets the count of columns in the current grid row.
public int GridColumnWidth { get; set; }
Property Value
- int
The number of grid row columns, e.g. 3
GridRowColumnCount
Gets the count of columns in the current grid row.
public int GridRowColumnCount { get; set; }
Property Value
- int
The number of grid row columns, e.g. 3
Header
Gets the header (name) of the paragraph.
public string? Header { get; set; }
Property Value
- string
The header or name e.g 'my paragraph name'.
ID
public int ID { get; set; }
Property Value
- int
The paragraph id e.g. 1.
Image
Gets the relative path to the image selected or linked on the paragraph.
public string? Image { get; set; }
Property Value
- string
The path to the image, e.g. /Files/Images/Image.jpg or http://domain.com/image.jpg.
ImageAlt
Gets the alt-text of the image.
public string? ImageAlt { get; set; }
Property Value
- string
Any string, e.g. "image of a penguin with our yellow hat on".
ImageCaption
Gets the image caption.
public string? ImageCaption { get; set; }
Property Value
- string
The image caption e.g "Electric bike - EV1 Bike".
ImageFocalPositionFromLeft
Gets the focal points position from the left edge of the image in percentage.
public int ImageFocalPositionFromLeft { get; }
Property Value
- int
A number between 0 and 100 that tells in percent how far from the left of the image the focal point is on the x-axis (horizontal)
ImageFocalPositionFromTop
Gets the focal points position from the top edge of the image in percentage.
public int ImageFocalPositionFromTop { get; }
Property Value
- int
A number between 0 and 100 that tells in percent how far from the top of the image the focal point is on the y-axis (vertical)
ImageFocalX
Gets or sets the x axis focal point.
public int ImageFocalX { get; set; }
Property Value
- int
A number between -100 and 100 that tells in percent how far from the middle of the image the focal point is on the x-axis
Remarks
Negative numbers are left of the middle, positive right of the middle
ImageFocalY
Gets or sets the y axis focal point.
public int ImageFocalY { get; set; }
Property Value
- int
A number between -100 and 100 that tells in percent how far from the middle of the image the focal point is on the y-axis
Remarks
Negative numbers are below the middle, positive above the middle
ImageLink
Gets the link specified in the image settings.
public string? ImageLink { get; set; }
Property Value
- string
The image link as an URL e.g. default.aspx?id=1 or /home or http://domain.com/about.
ImageLinkTarget
Gets the image link target associated to the ImageLink.
public string? ImageLinkTarget { get; set; }
Property Value
- string
Standard, _blank, _top, _self.
ImagePath
Gets the absolute image path.
public string? ImagePath { get; set; }
Property Value
- string
The absolute image path i.e. c:/website/Files/Images/View.jpg.
Item
If this paragraph has an item associated with it, this property gives you access to the item viewmodel which is used to access item content.
public ItemViewModel? Item { get; set; }
Property Value
- ItemViewModel
The Item-viewmodel or null.
ItemId
Gets the item id.
public string? ItemId { get; set; }
Property Value
- string
E.g. 5
- See Also
ItemType
Gets the item type system name.
public string? ItemType { get; set; }
Property Value
- string
E.g. 'myItemtype'
- See Also
ModuleSystemName
Gets the system name of the module (app) attached to the paragraph.
public string? ModuleSystemName { get; set; }
Property Value
- string
The system name of the module e.g. 'basicform' for forms module.
PageID
Gets the page id of the page the paragraph belongs to.
public int PageID { get; set; }
Property Value
- int
E.g. 1
Sort
Gets or sets the sort order of the paragraph.
public int Sort { get; set; }
Property Value
- int
An integer representing the sort order for displaying paragraph on the page it belongs.
Template
Gets the layout template selected for this paragraph. Not set if the template is not explicitly selected on the paragraph.
public string? Template { get; set; }
Property Value
- string
The name of the template e.g. "mytemplate.cshtml".
Text
Gets the default paragraph rich text field content.
public string? Text { get; set; }
Property Value
- string
The text e.g. "this is the paragraph text".
Methods
GetImageFocalPointParameters()
Returns a focal point parameter string for use with GetImage.ashx.
public string GetImageFocalPointParameters()
Returns
- string
If ImageHasFocalPoint() is true, the return is a strings of the following structure "x=ImageFocalX&y=ImageFocalY" Otherwise the return is Empty.
Remarks
Returns focal point in the format: x=75&y=23 If focal points are not defined (if they are both 0) this method returns an empty string.
GetModuleOutput()
Returns the module (app) output of this paragraph if a module is attached. An instance of ContentModule is created matching the name of the ModuleSystemName on the name of the AddInNameAttribute on the class.
public string? GetModuleOutput()
Returns
- string
A string of html containing the rendering of the module. If no module is attached (ModuleSystemName is null) then an empty string is returned
Remarks
This method only executes the module once. If it is called more than once for each instance of a ParagraphViewModel, the result of the first call is returned.
ImageHasFocalPoint()
Detects if the current image has at least one focal point set.
public bool ImageHasFocalPoint()
Returns
- bool
If one of ImageFocalX or ImageFocalY are non-zero the return value is true. If both are 0, the return value is false.