1 | <?php |
||
25 | abstract class Plugin extends Component |
||
26 | { |
||
27 | /** |
||
28 | * @var string the map name |
||
29 | */ |
||
30 | public $map; |
||
31 | /** |
||
32 | * @var array the options for the underlying LeafLetJs JS component. |
||
33 | * Please refer to the LeafLetJs api reference for possible |
||
34 | * [options](http://leafletjs.com/reference.html). |
||
35 | */ |
||
36 | public $clientOptions = []; |
||
37 | /** |
||
38 | * @var array the event handlers for the underlying LeafletJs JS plugin. |
||
39 | * Please refer to the LeafLetJs js api object options for possible events. |
||
40 | */ |
||
41 | public $clientEvents = []; |
||
42 | /** |
||
43 | * @var string the variable name. If not null, then the js creation script |
||
44 | * will be returned as a variable. If null, then the js creation script will |
||
45 | * be returned as a constructor that you can use on other object's configuration options. |
||
46 | */ |
||
47 | private $_name; |
||
48 | |||
49 | /** |
||
50 | * Returns the name of the layer. |
||
51 | * |
||
52 | * @param boolean $autoGenerate whether to generate a name if it is not set previously |
||
53 | * |
||
54 | * @return string name of the layer. |
||
55 | */ |
||
56 | 18 | public function getName($autoGenerate = false) |
|
63 | |||
64 | /** |
||
65 | * Sets the name of the layer. |
||
66 | * |
||
67 | * @param string $value name of the layer. |
||
68 | */ |
||
69 | 18 | public function setName($value) |
|
73 | |||
74 | /** |
||
75 | * Returns the processed js options |
||
76 | * @return array |
||
77 | */ |
||
78 | 15 | public function getOptions() |
|
82 | |||
83 | /** |
||
84 | * @return string the processed js events |
||
85 | */ |
||
86 | 15 | public function getEvents() |
|
97 | |||
98 | /** |
||
99 | * Returns the plugin name |
||
100 | * @return string |
||
101 | */ |
||
102 | abstract public function getPluginName(); |
||
103 | |||
104 | /** |
||
105 | * Registers plugin asset bundle |
||
106 | * |
||
107 | * @param \yii\web\View $view |
||
108 | * |
||
109 | * @return mixed |
||
110 | */ |
||
111 | abstract public function registerAssetBundle($view); |
||
112 | |||
113 | /** |
||
114 | * Returns the javascript ready code for the object to render |
||
115 | * @return \yii\web\JsExpression |
||
116 | */ |
||
117 | abstract public function encode(); |
||
118 | } |
||
119 |