1 | <?php |
||
8 | abstract class AbstractComponent |
||
9 | extends Template |
||
|
|||
10 | { |
||
11 | /** |
||
12 | * This template is used to generate the name for this component. the token |
||
13 | * {{name}} will be replaced by the component's name during runtime. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | public $name_template = '{{name}}'; |
||
18 | |||
19 | /** |
||
20 | * This template is used to generate the name for this component when it is |
||
21 | * used as a child component in a composite component. The token |
||
22 | * {{parent_name}} will be replaced with the name of the parent (composite) |
||
23 | * component. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | public $composite_name_template = '{{parent_name}}[{{name}}]'; |
||
28 | |||
29 | /** |
||
30 | * Constructor |
||
31 | * |
||
32 | * @param array $model |
||
33 | */ |
||
34 | public function __construct( array $model = array() ) |
||
39 | |||
40 | /** |
||
41 | * The default model to use when none is provided to the constructor. |
||
42 | * This method should be overriden by child class to define the default |
||
43 | * model. |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | public function default_model() |
||
51 | |||
52 | /** |
||
53 | * The list of required model arguments. |
||
54 | * This method should be overriden by child class to specify required model |
||
55 | * arguments. |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | public function required_arguments() |
||
63 | |||
64 | /** |
||
65 | * Set the model data for this component. |
||
66 | * |
||
67 | * @return array |
||
68 | */ |
||
69 | public function set_model( $model ) |
||
88 | |||
89 | /** |
||
90 | * Get the name for this component by parsing the name template. |
||
91 | * |
||
92 | * @return type |
||
93 | */ |
||
94 | public function get_name() |
||
98 | |||
99 | public function component_attributes() |
||
107 | |||
108 | /** |
||
109 | * A hook that is called once the component has been created. |
||
110 | */ |
||
111 | protected function on_created() {} |
||
112 | } |