/
Control.php
41 lines (36 loc) · 870 Bytes
/
Control.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace DJEM\Editor;
use BadMethodCallException;
class Control
{
public static function __callStatic($name, $args)
{
// create controls
$methods = [
'button',
'checkbox',
'date',
'grid',
'hidden',
'hlayout',
'image',
'images',
'label',
'layout',
'richText',
'select',
'staticHtml',
'staticImage',
'tabPanel',
'tag',
'text',
'textArea',
'time',
'vlayout',
];
if (! in_array($name, $methods)) {
throw new BadMethodCallException('Call to undefined method '.self::class.'::'.$name);
}
return Controls\Item::createControl(ucfirst($name), $args);
}
}