]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/framework/Web/UI/WebControls/TContentPlaceHolder.php
Add Baculum
[bacula/bacula] / gui / baculum / framework / Web / UI / WebControls / TContentPlaceHolder.php
1 <?php
2 /**
3  * TContentPlaceHolder class file.
4  *
5  * @author Qiang Xue <qiang.xue@gmail.com>
6  * @link http://www.pradosoft.com/
7  * @copyright Copyright &copy; 2005-2013 PradoSoft
8  * @license http://www.pradosoft.com/license/
9  * @version $Id: TContentPlaceHolder.php 3245 2013-01-07 20:23:32Z ctrlaltca $
10  * @package System.Web.UI.WebControls
11  */
12
13 /**
14  * TContentPlaceHolder class
15  *
16  * TContentPlaceHolder reserves a place on a template where a {@link TContent}
17  * control can inject itself and its children in. TContentPlaceHolder and {@link TContent}
18  * together implement a decoration pattern for prado templated controls.
19  * A template control (called content control) can specify a master control
20  * whose template contains some TContentPlaceHolder controls.
21  * {@link TContent} controls on the content control's template will replace the corresponding
22  * {@link TContentPlaceHolder} controls on the master control's template.
23  * This is called content injection. It is done by matching the IDs of
24  * {@link TContent} and {@link TContentPlaceHolder} controls.
25  *
26  * @author Qiang Xue <qiang.xue@gmail.com>
27  * @version $Id: TContentPlaceHolder.php 3245 2013-01-07 20:23:32Z ctrlaltca $
28  * @package System.Web.UI.WebControls
29  * @since 3.0
30  */
31 class TContentPlaceHolder extends TControl
32 {
33         /**
34          * This method is invoked after the control is instantiated on a template.
35          * This overrides the parent implementation by registering the content placeholder
36          * control to the template owner control. The placeholder control will NOT
37          * be added to the potential parent 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('contentplaceholder_id_required');
44                 $this->getTemplateControl()->registerContentPlaceHolder($id,$this);
45                 $parent->getControls()->add($this);
46         }
47 }
48