Map¶
- class BeastBytes\Yii\Leaflet\Map¶
A Leaflet map
- __construct(AssetManager $assetManager, private WebView $webView)¶
Create a new Map instance
- Returns:
A new Map instance
- Return type:
- addAttributes(array $valuesMap)¶
Add HTML attributes for the container tag
- Returns:
A new Map instance with the HTML attributes added
- Return type:
- addClass(string ...$value)¶
Add classes to the container tag
- Parameters:
...$value (
string) – The class(es) to add
- Returns:
A new Map instance with the class(es) added
- Return type:
- addControls(Control ...$controls)¶
Add controls to the map
- Parameters:
...$control (
Control) – The control(s) to add
- Returns:
A new Map instance with control(s) added
- Return type:
- addLayers(array $layers)¶
Add layers to the map
- Parameters:
$layers (
array[string=>Layer]) – The layer(s) to add where the keys are the layer names
- Returns:
A new Map instance with the layer(s) added
- Return type:
- addPlugins(Component ...$plugins)¶
Add plugins to the map
- getId()¶
Return the map HTML ID
- Returns:
The map HTML ID
- Return type:
string
- getLeafletVar()¶
Return the map Leaflet variable name
- Returns:
The map Leaflet variable name
- Return type:
string
- id(string $value)¶
Set the map widget HTML ID
- Parameters:
$id (
string) – The map widget HTML ID
- Returns:
A new Map instance with the map widget HTML ID
- Return type:
- leafletVar(string $leafletVar)¶
Set the map Leaflet variable name
- Parameters:
$leafletVar (
string) – The Leaflet variable name
- Returns:
A new Map instance with the Leaflet variable name
- Return type:
- options(array $options)¶
Set the map options
- Parameters:
array[string=>mixed] – The map options
- Returns:
A new Map instance with the map options added
- Return type:
- render()¶
Render the map HTML and register the Leaflet JavaScript
- Returns:
The map HTML
- Return type:
string