FeatureGroup Class

class BeastBytes\Yii\Leaflet\Layers\Other\FeatureGroup

Represents a FeatureGroup; an extended LayerGroup that makes it easier to do the same thing to all its member layers:

  • bindPopup and bindTooltip bind a popup/tooltip to all of the layers

  • Events are propagated to the FeatureGroup, so if the group has an event handler,

    it will handle events, including mouse events and custom events, from any of the layers

  • Has layeradd and layerremove events

__construct(array $layers = [], array $options = [])

Create a new FeatureGroup instance

Parameters:
  • $layers (list<Layer>.) – The FeatureGroup geographical layers

  • $options (array<string, mixed>.) – FeatureGroup options

Returns:

A new FeatureGroup instance

Return type:

FeatureGroup

Inherited from Layer

BeastBytes\Yii\Leaflet\Layers\Other\FeatureGroup::popup(string $content, array $options = [])

Binds a popup to the layer

Parameters:
  • $content (string) – The popup content

  • $options (array<string, mixed>.) – Popup options

Returns:

A new instance of FeatureGroup with the popup

Return type:

FeatureGroup

BeastBytes\Yii\Leaflet\Layers\Other\FeatureGroup::tooltip(string $content, array $options = [])

Binds a tooltip to the layer

Parameters:
  • $content (string) – The tooltip content

  • $options (array<string, mixed>.) – Tooltip options

Returns:

A new instance of FeatureGroup with the tooltip

Return type:

FeatureGroup

Inherited from Component

BeastBytes\Yii\Leaflet\Layers\Other\FeatureGroup::addToMap(bool $addToMap)

Whether to add the component to the map

By default, a component is added to the map.

Parameters:
  • $addToMap (bool) – Whether the component is added to the map

Returns:

A new instance of FeatureGroup with the addToMap parameter set

Return type:

FeatureGroup

BeastBytes\Yii\Leaflet\Layers\Other\FeatureGroup::getJsVar()

Returns the JavaScript variable name

Returns:

The JavaScript variable name

Return type:

string

BeastBytes\Yii\Leaflet\Layers\Other\FeatureGroup::jsVar(string $jsVar)

Set the JavaScript variable name

Parameters:
  • $jsVar (string) – The JavaScript variable name

Returns:

A new instance of FeatureGroup with the JavaScript variable name set

Return type:

FeatureGroup