| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* TContent class file.
|
|
|
4 |
*
|
|
|
5 |
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
|
6 |
* @link http://www.pradosoft.com/
|
|
|
7 |
* @copyright Copyright © 2005-2008 PradoSoft
|
|
|
8 |
* @license http://www.pradosoft.com/license/
|
|
|
9 |
* @version $Id: TContent.php 2541 2008-10-21 15:05:13Z qiang.xue $
|
|
|
10 |
* @package System.Web.UI.WebControls
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
* TContent class
|
|
|
15 |
*
|
|
|
16 |
* TContent specifies a block of content on a control's template
|
|
|
17 |
* that will be injected at somewhere of the master control's template.
|
|
|
18 |
* TContentPlaceHolder and {@link TContent} together implement a decoration
|
|
|
19 |
* pattern for prado templated controls. A template control
|
|
|
20 |
* (called content control) can specify a master control
|
|
|
21 |
* whose template contains some TContentPlaceHolder controls.
|
|
|
22 |
* {@link TContent} controls on the content control's template will replace the corresponding
|
|
|
23 |
* {@link TContentPlaceHolder} controls on the master control's template.
|
|
|
24 |
* This is called content injection. It is done by matching the IDs of
|
|
|
25 |
* {@link TContent} and {@link TContentPlaceHolder} controls.
|
|
|
26 |
*
|
|
|
27 |
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
|
28 |
* @version $Id: TContent.php 2541 2008-10-21 15:05:13Z qiang.xue $
|
|
|
29 |
* @package System.Web.UI.WebControls
|
|
|
30 |
* @since 3.0
|
|
|
31 |
*/
|
|
|
32 |
class TContent extends TControl implements INamingContainer
|
|
|
33 |
{
|
|
|
34 |
/**
|
|
|
35 |
* This method is invoked after the control is instantiated on a template.
|
|
|
36 |
* This overrides the parent implementation by registering the content control
|
|
|
37 |
* to the template owner control.
|
|
|
38 |
* @param TControl potential parent of this control
|
|
|
39 |
*/
|
|
|
40 |
public function createdOnTemplate($parent)
|
|
|
41 |
{
|
|
|
42 |
if(($id=$this->getID())==='')
|
|
|
43 |
throw new TConfigurationException('content_id_required');
|
|
|
44 |
$this->getTemplateControl()->registerContent($id,$this);
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
|