| 1 | <?php |
||
| 4 | trait TComponentView |
||
| 5 | { |
||
| 6 | use TRenderable { |
||
| 7 | TRenderable::getTemplate as private getTemplateInternal; |
||
| 8 | } |
||
| 9 | |||
| 10 | protected $render_section; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Returns variables for usage inside view template. |
||
| 14 | * |
||
| 15 | * @return array |
||
| 16 | */ |
||
| 17 | protected function getViewData() |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Returns name of view template. |
||
| 26 | * |
||
| 27 | * @return string |
||
| 28 | */ |
||
| 29 | public function getTemplate() |
||
| 30 | { |
||
| 31 | $grid_tpl = $this->grid->getConfig()->getTemplate(); |
||
| 32 | return str_replace('*.',"$grid_tpl.", $this->template); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Returns name of section in parent component |
||
| 37 | * where this component must be rendered. |
||
| 38 | * |
||
| 39 | * @return string|null |
||
| 40 | */ |
||
| 41 | public function getRenderSection() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Sets name of section in parent component |
||
| 48 | * where this component must be rendered. |
||
| 49 | * |
||
| 50 | * @param string|null $sectionName |
||
| 51 | * @return $this |
||
| 52 | */ |
||
| 53 | public function setRenderSection($sectionName) |
||
| 58 | } |
||
| 59 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: