Skip to content

Commit

Permalink
Merge pull request #550 from code16/conditionable-layout
Browse files Browse the repository at this point in the history
[8.0] Define layout classes as Conditionable
  • Loading branch information
aguingand authored Jul 15, 2024
2 parents 219e9de + 551175c commit c263ec0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/EntityList/Fields/EntityListFieldsContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
namespace Code16\Sharp\EntityList\Fields;

use Illuminate\Support\Collection;
use Illuminate\Support\Traits\Conditionable;

class EntityListFieldsContainer
{
use Conditionable;

protected array $fields = [];

final public function addField(EntityListField $field): self
Expand Down
4 changes: 4 additions & 0 deletions src/Form/Layout/FormLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

namespace Code16\Sharp\Form\Layout;

use Illuminate\Support\Traits\Conditionable;

class FormLayout implements HasLayout
{
use Conditionable;

protected array $tabs = [];
protected bool $tabbed = true;

Expand Down
3 changes: 3 additions & 0 deletions src/Form/Layout/HasFieldRows.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
namespace Code16\Sharp\Form\Layout;

use Code16\Sharp\Utils\Layout\LayoutField;
use Illuminate\Support\Traits\Conditionable;

trait HasFieldRows
{
use Conditionable;

protected array $rows = [];

public function withSingleField(string $fieldKey, \Closure $subLayoutCallback = null): self
Expand Down
3 changes: 3 additions & 0 deletions src/Show/Layout/ShowLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
namespace Code16\Sharp\Show\Layout;

use Code16\Sharp\Form\Layout\HasLayout;
use Illuminate\Support\Traits\Conditionable;

class ShowLayout implements HasLayout
{
use Conditionable;

protected array $sections = [];

final public function addSection(string $label, \Closure $callback = null): self
Expand Down
3 changes: 3 additions & 0 deletions src/Utils/Fields/FieldsContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

use Code16\Sharp\Form\Fields\SharpFormField;
use Code16\Sharp\Show\Fields\SharpShowField;
use Illuminate\Support\Traits\Conditionable;

class FieldsContainer
{
use Conditionable;

protected array $fields = [];

public function addField(SharpFormField|SharpShowField $field): self
Expand Down

0 comments on commit c263ec0

Please sign in to comment.