public function addElement(AbstractClassContent $element, $index = null, $setMainNode = false, $contentSetPos = 0)
    {
        if (null !== $index) {
            $index = intval($index);
            if (!array_key_exists($index, $this->elements)) {
                throw new \InvalidArgumentException();
            }

            $this->elements[$index] = array(
                'content'               => $element,
                'set_main_node'         => (true === $setMainNode),
                'content_set_position'  => $contentSetPos,
            );
        } else {
            $this->pushElement($element, $setMainNode, $contentSetPos);
        }

        return $this;
    }
public function addElement(AbstractClassContent $element, $index = null, $setMainNode = false, $contentSetPos = 0)
    {
        if (null !== $index) {
            $index = intval($index);
            if (!array_key_exists($index, $this->elements)) {
                throw new \InvalidArgumentException();
            }

            $this->elements[$index] = array(
                'content'               => $element,
                'set_main_node'         => (true === $setMainNode),
                'content_set_position'  => $contentSetPos,
            );
        } else {
            $this->pushElement($element, $setMainNode, $contentSetPos);
        }

        return $this;
    }
public function addElement ( AbstractClassContent $ element , $ index = null , $ setMainNode = false , $ contentSetPos = 0 ) { if ( null !== $ index ) { $ index = intval ( $ index ) ; if ( ! array_key_exists ( $ index , $ this -> elements ) ) { throw new \ InvalidArgumentException ( ) ; } $ this -> elements [ $ index ] = array ( 'content' => $ element , 'set_main_node' => ( true === $ setMainNode ) , 'content_set_position' => $ contentSetPos , ) ; } else { $ this -> pushElement ( $ element , $ setMainNode , $ contentSetPos ) ; } return $ this ; }
Add a content into a page.

@param AbstractClassContent  $element            The content to be add.
@param integer|null          $index              Optional, if provided replace content at index $index.
@param boolean               $setMainNode        Optional, is the main node to be set? (false by deault).
@param integer               $contentSetPos      Optional, the column index in which to push content (0 by default).

@return PageBuilder                              The builder instance.

@throws \InvalidArgumentException                Raises if $index does not exist.
Add a content into a page .