Skip to content

Commit

Permalink
Section Fieldtype should not be listable (#2425)
Browse files Browse the repository at this point in the history
* If fieldtype is section, don't return as listable

* Don't show 'Listable' option to user for Section fieldtype
  • Loading branch information
Duncan McClean authored Sep 14, 2020
1 parent 67b30e6 commit 25ae40b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ public function isListable()
return true;
}

if ($this->config()['type'] === 'section') {
return false;
}

return (bool) $this->get('listable');
}

Expand Down
3 changes: 3 additions & 0 deletions src/Http/Controllers/CP/Fields/FieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ protected function blueprint($blueprint)
],
'default' => 'hidden',
'width' => 50,
'unless' => [
'type' => 'section',
],
],
]);

Expand Down

0 comments on commit 25ae40b

Please sign in to comment.