| Total Complexity | 7 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Coverage | 64.71% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | trait HasLayoutsMenu |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Initialise trait in Flexible constructor. |
||
| 9 | */ |
||
| 10 | 15 | protected function initializeHasLayoutsMenu(): void |
|
| 11 | { |
||
| 12 | 15 | $this->useDefaultLayoutsMenu(); |
|
| 13 | } |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Set the dropdown button configuration. |
||
| 17 | */ |
||
| 18 | 15 | public function layoutsMenuButton(?string $buttonText = null, array $options = []): static |
|
| 19 | { |
||
| 20 | 15 | return $this->withMeta([ |
|
|
|
|||
| 21 | 15 | 'button' => $buttonText, |
|
| 22 | 15 | 'buttonOptions' => $options, |
|
| 23 | 15 | ]); |
|
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Set custom dropdown menu component. |
||
| 28 | */ |
||
| 29 | 15 | public function layoutsMenu(string $component = '', array $componentOptions = []): static |
|
| 30 | { |
||
| 31 | 15 | return $this->withMeta(['menu' => ['component' => $component, 'data' => $componentOptions]]); |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Set custom dropdown menu component. |
||
| 36 | */ |
||
| 37 | 15 | public function useDefaultLayoutsMenu(array $componentOptions = []): static |
|
| 38 | { |
||
| 39 | 15 | return $this->layoutsMenu('FlexibleDefaultMenu', $componentOptions); |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Set custom dropdown menu component. |
||
| 44 | */ |
||
| 45 | public function useSearchableLayoutsMenu(array $componentOptions = []): static |
||
| 46 | { |
||
| 47 | return $this->layoutsMenu('FlexibleSearchableMenu', $componentOptions); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @deprecated |
||
| 52 | */ |
||
| 53 | public function button(?string $label = null): static |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @deprecated |
||
| 60 | */ |
||
| 61 | public function menu(string $component, array $data = []): static |
||
| 64 | } |
||
| 65 | } |
||
| 66 |