function setExpanded($headername, $expanded = true, $ignoreuserstate = false) {
        if (empty($headername)) {
            return;
        }
        $element = $this->getElement($headername);
        if ($element->getType() != 'header') {
            debugging('Cannot use setExpanded on non-header elements', DEBUG_DEVELOPER);
            return;
        }
        if (!$headerid = $element->getAttribute('id')) {
            $element->_generateId();
            $headerid = $element->getAttribute('id');
        }
        if ($this->getElementType('mform_isexpanded_' . $headerid) === false) {
            // See if the form has been submitted already.
            $formexpanded = optional_param('mform_isexpanded_' . $headerid, -1, PARAM_INT);
            if (!$ignoreuserstate && $formexpanded != -1) {
                // Override expanded state with the form variable.
                $expanded = $formexpanded;
            }
            // Create the form element for storing expanded state.
            $this->addElement('hidden', 'mform_isexpanded_' . $headerid);
            $this->setType('mform_isexpanded_' . $headerid, PARAM_INT);
            $this->setConstant('mform_isexpanded_' . $headerid, (int) $expanded);
        }
        $this->_collapsibleElements[$headername] = !$expanded;
    }
function setExpanded($headername, $expanded = true, $ignoreuserstate = false) {
        if (empty($headername)) {
            return;
        }
        $element = $this->getElement($headername);
        if ($element->getType() != 'header') {
            debugging('Cannot use setExpanded on non-header elements', DEBUG_DEVELOPER);
            return;
        }
        if (!$headerid = $element->getAttribute('id')) {
            $element->_generateId();
            $headerid = $element->getAttribute('id');
        }
        if ($this->getElementType('mform_isexpanded_' . $headerid) === false) {
            // See if the form has been submitted already.
            $formexpanded = optional_param('mform_isexpanded_' . $headerid, -1, PARAM_INT);
            if (!$ignoreuserstate && $formexpanded != -1) {
                // Override expanded state with the form variable.
                $expanded = $formexpanded;
            }
            // Create the form element for storing expanded state.
            $this->addElement('hidden', 'mform_isexpanded_' . $headerid);
            $this->setType('mform_isexpanded_' . $headerid, PARAM_INT);
            $this->setConstant('mform_isexpanded_' . $headerid, (int) $expanded);
        }
        $this->_collapsibleElements[$headername] = !$expanded;
    }
function setExpanded ( $ headername , $ expanded = true , $ ignoreuserstate = false ) { if ( empty ( $ headername ) ) { return ; } $ element = $ this -> getElement ( $ headername ) ; if ( $ element -> getType ( ) != 'header' ) { debugging ( 'Cannot use setExpanded on non-header elements' , DEBUG_DEVELOPER ) ; return ; } if ( ! $ headerid = $ element -> getAttribute ( 'id' ) ) { $ element -> _generateId ( ) ; $ headerid = $ element -> getAttribute ( 'id' ) ; } if ( $ this -> getElementType ( 'mform_isexpanded_' . $ headerid ) === false ) { // See if the form has been submitted already. $ formexpanded = optional_param ( 'mform_isexpanded_' . $ headerid , - 1 , PARAM_INT ) ; if ( ! $ ignoreuserstate && $ formexpanded != - 1 ) { // Override expanded state with the form variable. $ expanded = $ formexpanded ; } // Create the form element for storing expanded state. $ this -> addElement ( 'hidden' , 'mform_isexpanded_' . $ headerid ) ; $ this -> setType ( 'mform_isexpanded_' . $ headerid , PARAM_INT ) ; $ this -> setConstant ( 'mform_isexpanded_' . $ headerid , ( int ) $ expanded ) ; } $ this -> _collapsibleElements [ $ headername ] = ! $ expanded ; }
Use this method to indicate that the fieldset should be shown as expanded.
The method is applicable to header elements only.

@param string $headername header element name
@param boolean $expanded default true sets the element to expanded. False makes the element collapsed.
@param boolean $ignoreuserstate override the state regardless of the state it was on when
the form was submitted.
@return void
Use this method to indicate that the fieldset should be shown as expanded . The method is applicable to header elements only .