Horde_Form::removeVariable PHP Method

removeVariable() public method

As only variables can be passed by reference, you need to call this method this way if want to pass a variable name: $form->removeVariable($var = 'varname');
public removeVariable ( Horde_Form_Variable | string &$var ) : boolean
$var Horde_Form_Variable | string Either the variable's name or the variable to remove from the form.
return boolean True if the variable was found (and deleted).
    function removeVariable(&$var)
    {
        foreach (array_keys($this->_variables) as $section) {
            foreach (array_keys($this->_variables[$section]) as $i) {
                if (is_a($var, 'Horde_Form_Variable') && $this->_variables[$section][$i] === $var || $this->_variables[$section][$i]->getVarName() == $var) {
                    // Slice out the variable to be removed.
                    $this->_variables[$section] = array_merge(array_slice($this->_variables[$section], 0, $i), array_slice($this->_variables[$section], $i + 1));
                    return true;
                }
            }
        }
        return false;
    }