Swat/SwatWidget.php
final protected function addCompositeWidget(SwatWidget $widget, $key)
    {
        if (array_key_exists($key, $this->composite_widgets)) {
            throw new SwatDuplicateIdException(
                sprintf(
                    "A composite widget with the key '%s' already exists in this " .
                        "widget.",
                    $key
                ),
                0,
                $key
            );
        }

        if ($widget->parent !== null) {
            throw new SwatException(
                'Cannot add a composite widget that already has a parent.'
            );
        }

        $this->composite_widgets[$key] = $widget;
        $widget->parent = $this;
    }
final protected function addCompositeWidget(SwatWidget $widget, $key)
    {
        if (array_key_exists($key, $this->composite_widgets)) {
            throw new SwatDuplicateIdException(
                sprintf(
                    "A composite widget with the key '%s' already exists in this " .
                        "widget.",
                    $key
                ),
                0,
                $key
            );
        }

        if ($widget->parent !== null) {
            throw new SwatException(
                'Cannot add a composite widget that already has a parent.'
            );
        }

        $this->composite_widgets[$key] = $widget;
        $widget->parent = $this;
    }
final protected function addCompositeWidget ( SwatWidget $ widget , $ key ) { if ( array_key_exists ( $ key , $ this -> composite_widgets ) ) { throw new SwatDuplicateIdException ( sprintf ( "A composite widget with the key '%s' already exists in this " . "widget." , $ key ) , 0 , $ key ) ; } if ( $ widget -> parent !== null ) { throw new SwatException ( 'Cannot add a composite widget that already has a parent.' ) ; } $ this -> composite_widgets [ $ key ] = $ widget ; $ widget -> parent = $ this ; }
Adds a composite a widget to this widget

@param SwatWidget $widget the composite widget to add.
@param string $key a key identifying the widget so it may be retrieved
later. The key does not have to be the widget's id
but the key does have to be unique within this
widget relative to the keys of other composite
widgets.

@throws SwatDuplicateIdException if a composite widget with the
specified key is already added to this
widget.
@throws SwatException if the specified widget is already the child of
another object.
Adds a composite a widget to this widget