Skip to content

Commit

Permalink
New method for Repeater ->labelEachRow(), show labels for each row
Browse files Browse the repository at this point in the history
  • Loading branch information
tanthammar committed Dec 4, 2020
1 parent 67316f3 commit 749cd5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/views/includes/array-wrapper.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@foreach($field->fields as $nested_field)
@php
$nested_field->key = "{$field->key}.{$key}.{$nested_field->name}";
$nested_field->show_label = $key === 0;
if (!$field->labelEachRow) $nested_field->show_label = $key === 0;
$nested_field->inline = $nested_field->inline ?? false;
$nested_field->inArray = true;
$nested_field->help = $key === 0 ? $nested_field->help : null;
Expand Down
7 changes: 7 additions & 0 deletions src/Repeater.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Repeater extends BaseField
use IsArrayField;

public $type = 'array';
public $labelEachRow = false;
public $array_sortable = false;
public $align_label_top = true;
public $allowed_in_repeater = false;
Expand All @@ -20,4 +21,10 @@ public function sortable(): self
$this->array_sortable = true;
return $this;
}

public function labelEachRow(): self
{
$this->labelEachRow = true;
return $this;
}
}

0 comments on commit 749cd5c

Please sign in to comment.