]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/framework/Web/UI/WebControls/TContentPlaceHolder.php
8a4d7284790b9c5e8c1b3bc7e1793039e30716a4
[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-2014 PradoSoft
8  * @license http://www.pradosoft.com/license/
9  * @package System.Web.UI.WebControls
10  */
11
12 /**
13  * TContentPlaceHolder class
14  *
15  * TContentPlaceHolder reserves a place on a template where a {@link TContent}
16  * control can inject itself and its children in. TContentPlaceHolder and {@link TContent}
17  * together implement a decoration pattern for prado templated controls.
18  * A template control (called content control) can specify a master control
19  * whose template contains some TContentPlaceHolder controls.
20  * {@link TContent} controls on the content control's template will replace the corresponding
21  * {@link TContentPlaceHolder} controls on the master control's template.
22  * This is called content injection. It is done by matching the IDs of
23  * {@link TContent} and {@link TContentPlaceHolder} controls.
24  *
25  * @author Qiang Xue <qiang.xue@gmail.com>
26  * @package System.Web.UI.WebControls
27  * @since 3.0
28  */
29 class TContentPlaceHolder extends TControl
30 {
31         /**
32          * This method is invoked after the control is instantiated on a template.
33          * This overrides the parent implementation by registering the content placeholder
34          * control to the template owner control. The placeholder control will NOT
35          * be added to the potential parent control!
36          * @param TControl potential parent of this control
37          */
38         public function createdOnTemplate($parent)
39         {
40                 if(($id=$this->getID())==='')
41                         throw new TConfigurationException('contentplaceholder_id_required');
42                 $this->getTemplateControl()->registerContentPlaceHolder($id,$this);
43                 $parent->getControls()->add($this);
44         }
45 }
46