Tailor\Classes\ContentDecoder\SubmissionDecoder
Overview
SubmissionDecoder applies visitor-submitted data using hardened trust rules, where nested arrays may only create new child records, scalar values may only associate published entries, and file values must be uploaded files.
Extends
Protected Properties
protected array $protectedKeys
protectedKeys are system columns a visitor may never write on a child record
protected array $associationTypes
associationTypes are relation types where a scalar value safely points at an existing record
protected array $htmlFieldTypes
htmlFieldTypes are field types that store visitor-authored HTML and must be sanitized before storage
protected $component
Public Methods
public __construct()
public __construct($component): void
__construct with the component providing uploaded file validation.
public sanitizeFieldValue()
public sanitizeFieldValue($field, $value): void
sanitizeFieldValue cleans visitor-authored HTML and drops color values that are not hex codes.
Inherited Public Methods
- decode() - applies each attribute in the data array to the model. (defined in Tailor\Classes\ContentDecoder\Decoder)
- decodeModelAttribute() - applies a single attribute value to the model. (defined in Tailor\Classes\ContentDecoder\Decoder)
Protected Methods
protected beforeDecodeAttribute()
protected beforeDecodeAttribute($model, $attr, &$value): bool
beforeDecodeAttribute drops attributes that are guarded or unknown to a child fieldset, and sanitizes scalar values before they reach the model.
protected coerceAssociationId()
protected coerceAssociationId($model, $attr, $value): void
coerceAssociationId permits scalar identifiers of published records only.
protected coerceChildAttributes()
protected coerceChildAttributes($model, $attr, $value): void
coerceChildAttributes strips system keys and validates the content group selection.
protected coerceRelationValue()
protected coerceRelationValue($model, $attr, $value): void
coerceRelationValue rejects values that do not describe new child records.
protected decodeFileRelation()
protected decodeFileRelation($model, $attr, $value, $sessionKey): void
decodeFileRelation accepts uploaded file instances only, validated against the field definition.
protected makeInvalidFieldException()
protected makeInvalidFieldException($attr): ValidationException
makeInvalidFieldException builds a field-keyed validation error.
protected validatePublishedRecords()
protected validatePublishedRecords($model, $attr, $ids): void
validatePublishedRecords rejects identifiers of missing or unpublished records.
Show inherited protected methods
Inherited Protected Methods
- decodeRepeaterItem() - applies nested data to a child record. (defined in Tailor\Classes\ContentDecoder\Decoder)
- decodeRepeaterItems() - builds child records from nested data. (defined in Tailor\Classes\ContentDecoder\Decoder)