RepeaterMatrixField::addMatrixType()
Add a new matrix type
Please note that the Field must also be saved after calling this in order to commit it to the database.
Example
$field = $fields->get('my_matrix_field');
$field->addMatrixType('mailing_address', [
'label' => 'Mailing address',
'fields' => [ 'street', 'city', 'state', 'zip' ];
]);
$field->save();Usage
// basic usage
$array = $repeaterMatrixField->addMatrixType(string $name);
// usage with all arguments
$array = $repeaterMatrixField->addMatrixType(string $name, array $options = []);Arguments
| Name | Type(s) | Description |
|---|---|---|
$name | string | Name for new matrix type |
$options (optional) | array | One or more of:
|
Return value
arrayInfo for the type added
Exceptions
Method can throw exceptions on error:
WireException- If given invalid name for type, or if name is already in use
RepeaterMatrixField methods and properties
API reference based on ProcessWire core version 3.0.260