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
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
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
columnFieldThe matrix column to test.
columnFieldTypeFieldTypeThe column's resolved field type; supplied by the caller, which already has it.
Returns
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
categoryTypeCategoryTypeThe category type to test.
Returns
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
fieldFieldThe category field to test.
Returns
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
fieldProductFieldThe category field to test.
Returns
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
fieldFieldThe category field to test.
Returns
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
fieldProductFieldThe category field to test.
Returns
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
requestedProductKeyThe coordinate to test.
defaultLanguageIdstringThe default language id.
Returns
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
columnFieldThe matrix column whose ownership flags decide the coordinate.
coordinateProductKeyThe coordinate the caller is currently working with.
defaultLanguageIdstringThe default language id.