/** * Repeatable containers has specific data saving structure. It's like this: * * [repeatableContainer][0][optionName] * [repeatableContainer][1][optionName] * * See the numbers, they are here to identify the repeatabling. * @param ffOneStructure $item */ private function _walkRepeatableContainer($item) { // IMAGE // TODO there MIGHT be problem when repeatables are 0,1,5,6,9,10 // [!!repeatableContainer!!] // [0][optionName] $this->_addRoute($item->getId()); // this handle the printe $this->_beforeContainer($item); // number of items, now we are returned [0][optionName] $currentRepeatableRoute = $this->_getCurrentRouteValue(); $repeatableCount = count($currentRepeatableRoute); // it's empty (mean nothing saved now), we then simply set this to 1 and default value aappears; if ($repeatableCount == 0) { $repeatableCount = 1; } // GO THROUGH ALL SAVED FILES, AND FIRST is -1 to generate template for javascript shti for ($i = -1; $i < $repeatableCount; $i++) { $this->_addRoute($i, true); if ($i == -1) { //$this->_addRoute( $this->_getNamePlaceholder($this->_getCurrentRouteCount()) ); $this->_beforeRepeatableTemplate($item, $this->_getNamePlaceholder($this->_getCurrentRouteCount() - 1)); $this->_beforeRepeatableNode($item, $this->_getNamePlaceholder($this->_getCurrentRouteCount() - 1)); } else { $this->_beforeRepeatableNode($item, $i); } foreach ($item->getData() as $childItem) { $this->_walkItem($childItem); } if ($i == -1) { $this->_afterRepeatableNode($item, $this->_getNamePlaceholder($this->_getCurrentRouteCount() - 1)); $this->_afterRepeatableTemplate($item, $this->_getNamePlaceholder($this->_getCurrentRouteCount() - 1)); } else { $this->_afterRepeatableNode($item, $i); } $this->_removeRoute(); } $this->_afterContainer($item); $this->_removeRoute(); }