_orientation; } public function setOrientation($orientation) { $this->_orientation = $orientation; return $this; } public function loadDefaultDecorators() { if ($this->loadDefaultDecoratorsIsDisabled()) { return $this; } $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('FormElements'); $this->addDecorator(['tr' => 'HtmlTag'], ['tag' => 'tr', 'data-collection-item' => $this->getName()]); } return $this; } public function render(Zend_View_Interface $view = null) { if ($this->getOrientation() == Table::ORIENTATION_VERTICAL) { $elements = []; foreach ($this as $item) { $elements[] = $item->getName(); } if ($this instanceof Table\Column\OptionsInterface && false !== ($index = array_search('options', $elements))) { unset($elements[$index]); } /** @var \Qs_Form_Decorator_FormElements $decorator */ if (($decorator = $this->getDecorator('FormElements'))) { $decorator->setOption('wrappers', [ [ 'elements' => $elements, 'decorators' => [ ['HtmlTag', ['tag' => 'dl']], ['HtmlTag', ['tag' => 'td', 'class' => 'c_elements']] ] ] ]); } } return parent::render($view); } public function addElement($element, $name = null, $options = null) { if ($this->getOrientation() == Table::ORIENTATION_VERTICAL) { return parent::addElement($element, $name, $options); } if (is_string($element)) { if (!is_array($options) || !array_key_exists('decorators', $options)) { $class = 'c_' . $name; if ($element == 'hidden') { $class .= ' hidden'; } $options['decorators'] = [$element == 'numeric' ? 'Numeric' : 'ViewHelper']; if ($element == 'HtmlEditor') { $options['decorators'][] = 'CkEditor'; } $options['decorators'] = array_merge($options['decorators'], [ 'Errors', 'Description', [ 'HtmlTag', [ 'tag' => 'td', 'class' => $class, 'id' => ['callback' => ['Zend_Form_Element', 'resolveElementId']] ] ] ]); } } return parent::addElement($element, $name, $options); } public function addRowNumber() { $index = (int) $this->getName(); $this->addElement('static', 'rowNumber', ['label' => '#', 'value' => $index + 1]); if (($decorator = $this->getElement('rowNumber')->getDecorator('HtmlTag'))) { $decorator->setOption('data-row-number', ''); } return $this; } public function isNumerable() { return ($number = $this->getElement('rowNumber')) && $number instanceof Qs_Form_Element_Static; } }