Table of Contents

Class MatrixHelper

Namespace
Dynamicweb.Ecommerce.Products
Assembly
Dynamicweb.Ecommerce.dll
public static class MatrixHelper
Inheritance
MatrixHelper
Inherited Members

Properties

AllowedColumnFieldTypes

Field type IDs that are allowed as columns inside a matrix category. Matches the types enforced by ProductAttributeEditScreen when editing matrix fields.

public static IReadOnlySet<int> AllowedColumnFieldTypes { get; }

Property Value

IReadOnlySet<int>

AllowedColumnListPresentationTypes

List presentation types that are allowed for List-type columns inside a matrix category. Matches the types enforced by ProductAttributeEditScreen when editing matrix fields.

public static IReadOnlySet<FieldListPresentationType> AllowedColumnListPresentationTypes { get; }

Property Value

IReadOnlySet<FieldListPresentationType>

Methods

CanRenderColumnEditor(Field, FieldType?)

Determines whether a matrix column can be given a cell editor: it has an id, and it is not a nested matrix column (which would recurse). That is all it checks — it does NOT consider ReadOnly, permissions, or AllowedColumnFieldTypes; callers combine those separately. A column that fails this check is never posted, so it must also stay out of a save's owned column set (see BuildMatrixSavePlan) — the owned set scopes the repository's cell delete, and an owned column that can never be posted would have its stored cells deleted on the next save. Both the schema builder and the save plan ask this one question so the two cannot drift apart.

public static bool CanRenderColumnEditor(Field column, FieldType? columnFieldType)

Parameters

column Field

The matrix column to test.

columnFieldType FieldType

The column's resolved field type; supplied by the caller, which already has it.

Returns

bool

true when the column can carry a cell editor; otherwise false.

IsMatrixColumnCategory(CategoryType)

Determines whether a category type identifies a matrix column category — a Category of type MatrixFields whose fields are the columns of a matrix. Centralises the equality check that was previously duplicated across every "is this a matrix column" call site.

public static bool IsMatrixColumnCategory(CategoryType categoryType)

Parameters

categoryType CategoryType

The category type to test.

Returns

bool

IsMatrixColumnField(Field)

Determines whether a category field is a matrix column field — i.e. it belongs to a MatrixFields category. Column fields are internal to the matrix and must never surface as standalone fields anywhere. Unlike IsMatrixColumnOrMatrixField(Field) this does NOT match the parent matrix field, so the parent can still be offered on output surfaces (feeds, ProductCatalog) that represent it as structured data.

public static bool IsMatrixColumnField(Field field)

Parameters

field Field

The category field to test.

Returns

bool

IsMatrixColumnField(ProductField)

Determines whether a category field is a matrix column field — i.e. it belongs to a MatrixFields category. Column fields are internal to the matrix and must never surface as standalone fields anywhere. Unlike IsMatrixColumnOrMatrixField(Field) this does NOT match the parent matrix field, so the parent can still be offered on output surfaces (feeds, ProductCatalog) that represent it as structured data.

public static bool IsMatrixColumnField(ProductField field)

Parameters

field ProductField

The category field to test.

Returns

bool

IsMatrixColumnOrMatrixField(Field)

Determines whether a category field must be hidden from generic field selectors that cannot represent a matrix (index/query, import mapping, export, copy, …). This is true when the field is a matrix column field (see IsMatrixColumnField(Field)) or is the parent matrix field itself. Output surfaces that render structured matrix data (feeds, ProductCatalog) use IsMatrixColumnField(Field) instead, so the parent stays selectable there.

public static bool IsMatrixColumnOrMatrixField(Field field)

Parameters

field Field

The category field to test.

Returns

bool

IsMatrixColumnOrMatrixField(ProductField)

Determines whether a category field must be hidden from generic field selectors that cannot represent a matrix (index/query, import mapping, export, copy, …). This is true when the field is a matrix column field (see IsMatrixColumnField(Field)) or is the parent matrix field itself. Output surfaces that render structured matrix data (feeds, ProductCatalog) use IsMatrixColumnField(Field) instead, so the parent stays selectable there.

public static bool IsMatrixColumnOrMatrixField(ProductField field)

Parameters

field ProductField

The category field to test.

Returns

bool

IsStructuralCoordinate(ProductKey, string)

Determines whether a coordinate owns matrix row structure (row order and row count) rather than just a cell value — true only for the master, default-language coordinate (empty variant AND default language).

public static bool IsStructuralCoordinate(ProductKey requested, string defaultLanguageId)

Parameters

requested ProductKey

The coordinate to test.

defaultLanguageId string

The default language id.

Returns

bool

OwnsMatrixColumn(Field, ProductKey, string)

Determines whether coordinate is the one coordinate that owns column's cells — the only place the column may be written, and therefore the only place it may be offered as an editable cell. The language axis follows AllowChangesAcrossLanguages and the variant axis AllowChangesAcrossVariants; a column a coordinate does not own is still rendered there, read-only, so an editor working on a variant keeps the shared columns for context. ShowFieldOnBothMasterAndVariant is deliberately NOT consulted, and never will be: at field level it additionally grants write access on a variant, but a matrix cell has exactly one owning coordinate, so a second coordinate writing the same cell has no defined resolution. The flag is hidden in the settings UI for matrix columns and forced to false on save.

public static bool OwnsMatrixColumn(Field column, ProductKey coordinate, string defaultLanguageId)

Parameters

column Field

The matrix column whose ownership flags decide the coordinate.

coordinate ProductKey

The coordinate the caller is currently working with.

defaultLanguageId string

The default language id.

Returns

bool
To top