1 | Index: inc/core/class.dc.core.php |
---|
2 | =================================================================== |
---|
3 | --- inc/core/class.dc.core.php (révision 2566) |
---|
4 | +++ inc/core/class.dc.core.php (copie de travail) |
---|
5 | @@ -243,11 +243,18 @@ |
---|
6 | |
---|
7 | @param behavior <b>string</b> Behavior name |
---|
8 | @param func <b>callback</b> Function to call |
---|
9 | + @param prepend <b>boolean</b> if true, insert behavior at first position |
---|
10 | */ |
---|
11 | - public function addBehavior($behavior,$func) |
---|
12 | + public function addBehavior($behavior,$func,$prepend=false) |
---|
13 | { |
---|
14 | if (is_callable($func)) { |
---|
15 | - $this->behaviors[$behavior][] = $func; |
---|
16 | + if (!$prepend) { |
---|
17 | + $this->behaviors[$behavior][] = $func; |
---|
18 | + } else { |
---|
19 | + if (!isset($this->behaviors[$behavior])) |
---|
20 | + $this->behaviors[$behavior]=array(); |
---|
21 | + array_unshift($this->behaviors[$behavior],$func); |
---|
22 | + } |
---|
23 | } |
---|
24 | } |
---|
25 | |
---|
26 | @@ -1457,4 +1464,4 @@ |
---|
27 | } |
---|
28 | //@} |
---|
29 | } |
---|
30 | -?> |
---|
31 | \ No newline at end of file |
---|
32 | +?> |
---|