| 1 | <?php |
||
| 19 | class MatrixBlockType extends Base |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * {@inheritdoc} |
||
| 23 | */ |
||
| 24 | public function getRecordDefinition(Model $record): array |
||
| 25 | { |
||
| 26 | $definition = parent::getRecordDefinition($record); |
||
| 27 | |||
| 28 | unset($definition['attributes']['fieldId']); |
||
| 29 | unset($definition['attributes']['hasFieldErrors']); |
||
| 30 | |||
| 31 | $definition['fields'] = Craft::$app->controller->module->modelMapper->export($record->fieldLayout->getFields()); |
||
| 32 | |||
| 33 | return $definition; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * {@inheritdoc} |
||
| 38 | */ |
||
| 39 | public function saveRecord(Model $record, array $definition): bool |
||
| 40 | { |
||
| 41 | if (array_key_exists('fields', $definition)) { |
||
| 42 | $context = 'matrixBlockType:'.$record->id; |
||
| 43 | $existingFields = Craft::$app->fields->getAllFields($context); |
||
| 44 | $fields = Craft::$app->controller->module->modelMapper->import($definition['fields'], $existingFields, ['context' => $context], false); |
||
| 45 | $record->setFields($fields); |
||
|
|
|||
| 46 | } |
||
| 47 | |||
| 48 | return Craft::$app->matrix->saveBlockType($record, false); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * {@inheritdoc} |
||
| 53 | */ |
||
| 54 | public function deleteRecord(Model $record): bool |
||
| 58 | } |
||
| 59 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.