LaravelRUS /
SleepingOwlAdmin
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SleepingOwl\Admin\Display; |
||
| 4 | |||
| 5 | use SleepingOwl\Admin\Contracts\Display\TabInterface; |
||
| 6 | use SleepingOwl\Admin\Contracts\Form\FormElementInterface; |
||
| 7 | use SleepingOwl\Admin\Form\FormElementsCollection; |
||
| 8 | |||
| 9 | class DisplayTabsCollection extends FormElementsCollection |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @return static |
||
| 13 | */ |
||
| 14 | public function onlyActive() |
||
| 15 | { |
||
| 16 | return $this->filter(function (TabInterface $tab) { |
||
| 17 | $element = $tab->getContent(); |
||
| 18 | |||
| 19 | if ($element instanceof FormElementInterface) { |
||
| 20 | return ! $element->isReadonly(); |
||
| 21 | } |
||
| 22 | |||
| 23 | return true; |
||
| 24 | })->onlyVisible(); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return static |
||
| 29 | */ |
||
| 30 | public function onlyVisible() |
||
| 31 | { |
||
| 32 | return $this->filter(function (TabInterface $tab) { |
||
| 33 | return $tab->isVisible(); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 34 | }); |
||
| 35 | } |
||
| 36 | } |
||
| 37 |