From 15f275ff1494e4a8197fea0f7ec6641040f0c692 Mon Sep 17 00:00:00 2001 From: Vitalik Date: Sun, 21 Apr 2024 02:59:19 +0300 Subject: [PATCH] Added a possibility to change 'Add row' label for matrix field (#2824) * Added a possibility to change 'Add row' label for matrix field * Move translation 'Add row' label to be historically --- resources/views/fields/matrix.blade.php | 2 +- src/Screen/Fields/Matrix.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/views/fields/matrix.blade.php b/resources/views/fields/matrix.blade.php index 0e4c21eb3..dbeea0970 100644 --- a/resources/views/fields/matrix.blade.php +++ b/resources/views/fields/matrix.blade.php @@ -25,7 +25,7 @@ - {{ __('Add row') }} + {{ __($addRowLabel) }} diff --git a/src/Screen/Fields/Matrix.php b/src/Screen/Fields/Matrix.php index fe92c5672..751a596be 100644 --- a/src/Screen/Fields/Matrix.php +++ b/src/Screen/Fields/Matrix.php @@ -33,6 +33,7 @@ class Matrix extends Field 'maxRows' => 0, 'keyValue' => false, 'fields' => [], + 'addRowLabel' => 'Add row', 'columns' => [ 'key', 'value', @@ -107,6 +108,16 @@ public function fields(array $fields = []): self return $this->set('fields', $fields); } + /** + * @param string $label + * + * @return self + */ + public function addRowLabel(string $label): self + { + return $this->set('addRowLabel', $label); + } + protected function getIdPrefix(): string { $idPrefix = $this->get('idPrefix');