CampContext::setCurrentList PHP Method

setCurrentList() public method

Sets the current list.
public setCurrentList ( object &$p_list, array $p_savePropertiesList = [] ) : void
$p_list object
$p_savePropertiesList array
return void
    public function setCurrentList(&$p_list, array $p_savePropertiesList = array())
    {
        if (!is_object($p_list)) {
            throw new InvalidObjectException($p_list);
        }
        $objectName = $this->GetListObjectName(get_class($p_list));
        if ($objectName == '' || !isset($this->m_listObjects[$objectName])) {
            throw new InvalidObjectException(get_class($p_list));
        }
        $listObjectName = $this->m_listObjects[$objectName]['class'] . 'List';
        if (!is_a($p_list, $listObjectName)) {
            throw new InvalidObjectException(get_class($p_list));
        }
        $p_list->setId($this->next_list_id($listObjectName));
        $listName = $this->m_listObjects[$objectName]['list'];
        if (!isset($this->m_list_count[$listName . '_lists'])) {
            $this->m_list_count[$listName . '_lists'] = 1;
        } else {
            $this->m_list_count[$listName . '_lists']++;
        }
        $this->SaveProperties($p_savePropertiesList);
        $this->m_readonlyProperties['lists'][] =& $p_list;
        $this->m_readonlyProperties['current_list'] =& $p_list;
        $this->m_readonlyProperties[$listName . '_lists'][] =& $p_list;
        $this->m_readonlyProperties['current_' . $listName . '_list'] =& $p_list;
        return $this->m_readonlyProperties;
    }