Repository: area17/twill (language: php)

Issue:
Formview <x-twill::browser> not honoring the `:endpoints` parameter properly
## Description

In formview forms, it doesn't seem like the `:endpoints` property is being assigned in the Browser model. In the [Browser constuctor](https://github.com/area17/twill/blob/3.x/src/View/Components/Fields/Browser.php#L1C1-L88C17) the `$endpoints` variable does have a value, but none of the assignments of `$this->endpoints` ever looks at this variable.

### Steps to reproduce

Create a formview browser using the `:endpoints` property. Something like:

```
<x-twill::browser
    name='welcome_note_section'
    label='Welcome note section'
    max='1'
    endpoints="[
        [
            'label' => 'Articles',
            'value' => '/collection/articlesPublications/digitalPublications/articles/browser'
        ]
    ]"
/>
```

### Expected result

On the form, I expect to see a browser that makes a request to `/collection/articlesPublications/digitalPublications/articles/browser?page=1` for content. 

### Actual result

The browser doesn't show the list box of possible models to add, and requests itself with `?page=1` for browser content.

### Versions

Twill version: 3.4.1
Laravel version: 10.19.0
PHP version: 8.2.14
Database engine: PostgreSQL 17



Discussion / hints:

Fix patch:
diff --git a/src/View/Components/Fields/Browser.php b/src/View/Components/Fields/Browser.php
index 1eda053bf2..a733fc8288 100644
--- a/src/View/Components/Fields/Browser.php
+++ b/src/View/Components/Fields/Browser.php
@@ -50,8 +50,8 @@ public function __construct(
             default: $default
         );
 
-        if (!$this->endpoints) {
-            $endpointsFromModules = isset($this->modules) ? collect($this->modules)->map(function ($module) {
+        if (!$this->endpoints && isset($this->modules)) {
+            $this->endpoints = collect($this->modules)->map(function ($module) {
                 return [
                     'label' => $module['label'] ?? ucfirst($module['name']),
                     'value' => moduleRoute(
@@ -62,16 +62,14 @@ public function __construct(
                         false
                     ),
                 ];
-            })->toArray() : null;
+            })->toArray();
         }
 
-        $this->endpoints = $this->endpoints === [] ? $endpointsFromModules ?? [] : [];
-
         if (empty($this->endpoints)) {
-            $routeEndpoint = $this->moduleName;
-            if ($this->routePrefix) {
-                $routeEndpoint = Str::replaceFirst($this->routePrefix . '.', '', $this->moduleName);
-            }
+            $routeEndpoint = $this->routePrefix
+                ? Str::replaceFirst($this->routePrefix . '.', '', $this->moduleName)
+                : $this->moduleName;
+
             $this->endpoint = $this->endpoint ?? (empty($endpoints) ? moduleRoute(
             // Remove the route prefix from the moduleName.
                 $routeEndpoint,


Test patch: