Example #1
0
 /**
  * Get an instance of the columnconfig class.
  *
  * @param Node $node
  * @param string $id
  * @param bool $forceNew force new instance?
  *
  * @return ColumnConfig An instance of the columnconfig class
  */
 public static function getConfig($node, $id = null, $forceNew = false)
 {
     static $s_instances = [];
     $sm = SessionManager::getInstance();
     if ($id == null) {
         $id = $node->atkNodeUri();
     }
     if (!isset($s_instances[$id]) || $forceNew) {
         $cc = new self();
         $s_instances[$id] = $cc;
         $cc->setNode($node);
         $colcfg = $sm != null ? $sm->pageVar('atkcolcfg_' . $id) : null;
         if (!is_array($colcfg) || $forceNew) {
             // create new
             Tools::atkdebug('New colconfig initialising');
             $cc->init();
         } else {
             // inherit old config from session.
             Tools::atkdebug('Resuming colconfig from session');
             $cc->m_colcfg =& $colcfg;
         }
         // See if there are any url params which influence this colcfg.
         $cc->doUrlCommands();
     }
     if ($sm != null) {
         $sm->pageVar('atkcolcfg_' . $id, $s_instances[$id]->m_colcfg);
     }
     return $s_instances[$id];
 }