public function addElement(
        $element,
        $menus,
        $stage,
        $priority = 0
    ) {
        $priority = (int) $priority;
        $elementId = spl_object_hash($element);
        $menus = is_array($menus)
            ? $menus
            : [$menus];

        if (empty($menus)) {
            $this->allElements[$elementId] = $element;
        } else {
            foreach ($menus as $menu) {
                $this->addElementByMenuCode(
                    $element,
                    $menu
                );
            }
        }

        $this->addElementByStage(
            $element,
            $stage
        );

        $this->priorities[$elementId] = $priority;

        return $this;
    }
public function addElement(
        $element,
        $menus,
        $stage,
        $priority = 0
    ) {
        $priority = (int) $priority;
        $elementId = spl_object_hash($element);
        $menus = is_array($menus)
            ? $menus
            : [$menus];

        if (empty($menus)) {
            $this->allElements[$elementId] = $element;
        } else {
            foreach ($menus as $menu) {
                $this->addElementByMenuCode(
                    $element,
                    $menu
                );
            }
        }

        $this->addElementByStage(
            $element,
            $stage
        );

        $this->priorities[$elementId] = $priority;

        return $this;
    }
public function addElement ( $ element , $ menus , $ stage , $ priority = 0 ) { $ priority = ( int ) $ priority ; $ elementId = spl_object_hash ( $ element ) ; $ menus = is_array ( $ menus ) ? $ menus : [ $ menus ] ; if ( empty ( $ menus ) ) { $ this -> allElements [ $ elementId ] = $ element ; } else { foreach ( $ menus as $ menu ) { $ this -> addElementByMenuCode ( $ element , $ menu ) ; } } $ this -> addElementByStage ( $ element , $ stage ) ; $ this -> priorities [ $ elementId ] = $ priority ; return $ this ; }
Add element.

@param mixed        $element  Element
@param array|string $menus    Menu codes
@param string       $stage    Stage
@param int          $priority Priority

@return $this Self object
Add element .