Example #1
0
 /**
  * Initializes the leaf
  * Passes the Parameters to its child leafs.
  *
  * @param int $index Index of this leaf
  * @param array $parentIndices Array with parent indices
  *
  * @return void
  */
 public function init($index, array $parentIndices = array())
 {
     if (!is_numeric($index) || !is_array($parentIndices)) {
         if (TYPO3_DLOG) {
             GeneralUtility::devLog('init (leaf) gets passed invalid parameters.', COMMERCE_EXTKEY, 3);
         }
         return;
     }
     // Store the index
     $this->view->setLeafIndex($index);
     $this->view->setParentIndices($parentIndices);
     // Add our own index to the parentIndices Array
     $parentIndices[] = $index;
     // Call 'init' for all child leafs - notice how the childleafs
     // are NOT read by mounts
     for ($i = 0; $i < $this->leafcount; ++$i) {
         // For every childleaf, set its parent leaf to the current leaf
         /**
          * Slave.
          *
          * @var \CommerceTeam\Commerce\Tree\Leaf\Slave $leafSlave
          */
         $leafSlave =& $this->leafs[$i];
         $leafSlave->setParentLeaf($this);
         $leafSlave->init($i, $parentIndices);
     }
 }