/** * Returns the current sub-form in a sequence and advances the internal pointer. * * @return Opf_Form */ public function getNextSubform() { $this->_current = current($this->_items[$this->_placeholder]); next($this->_items[$this->_placeholder]); if (is_object($this->_current)) { $this->_current->setView($this->_view); $this->_current->invokeEvent('preInit'); $this->_current->onInit(); $this->_current->invokeEvent('postInit'); } return $this->_current; }
/** * Returns the form stack head element. If the stack is empty, * the method returns NULL. * * @internal * @static * @return Opf_Form */ public static function topOfStack() { if (self::$_stack === null) { self::$_stack = new SplStack(); } if (self::$_stack->count() == 0) { return null; } return self::$_stack->top(); }
public function onInit() { $this->appendItem($item = new Opf_Repeater(new SingleForm('subform'), 10)); $item->setMinRequired(3); parent::onInit(); }
/** * Adds a form to the list of forms to make it available for the * templates. You do not have to use this method manually, as the * forms register themselves in templates automatically. * * @static * @param Opf_Form $form The form to register. * @throws Opf_ItemAlreadyExists_Exception */ public static function addForm(Opf_Form $form) { if (isset(self::$_forms[$form->getName()])) { throw new Opf_Exception('Form ' . $form->getName() . ' already exist.'); } self::$_forms[$form->getName()] = $form; }