addElementPrefixPath( 'App\\Company\\Admin\\Form\\Decorator', 'App/Company/Admin/Form/Decorator/', self::DECORATOR ); $this->addPrefixPath( 'App\\Company\\Admin\\Form\\Decorator', 'App/Company/Admin/Form/Decorator/', self::DECORATOR ); return parent::init(); } protected function _initElements() { $this->addElement( 'text', 'mnHouse', [ 'label' => 'MN House District', 'data-type' => Entity::DISTRICT_TYPE_MN_HOUSE, 'description' => $this->getConfig('districtFieldHint') ] ); $this->addElement( 'text', 'usCongressional', [ 'label' => 'US Congressional District', 'data-type' => Entity::DISTRICT_TYPE_US_CONGRESSIONAL, 'description' => $this->getConfig('districtFieldHint') ] ); $this->_prepareElementDecorators(); return $this; } protected function _prepareElementDecorators() { /** @var \Zend_Form_Element $element */ foreach ($this as $element) { $element->getDecorator('HtmlTag')->setOption('tag', 'td'); $element->getDecorator('Label')->setTag('td'); } return $this; } public function loadDefaultDecorators() { if ($this->loadDefaultDecoratorsIsDisabled()) { return $this; } $decorators = $this->getDecorators(); if (empty($decorators)) { $headerColumns = ['Type', 'Districts']; $this->addDecorator('LegislativeTableHeader', ['columns' => $headerColumns]); $this->addDecorator( ['tbodyOpen' => 'HtmlTag'], ['tag' => 'tbody', 'openOnly' => true, 'placement' => DecoratorAbstract::PREPEND] ); $this->addDecorator( 'FormElements', [ 'wrappers' => [ [ 'decorators' => [['HtmlTag', ['tag' => 'tr']]], 'elements' => ['mnHouse'], ], [ 'decorators' => [['HtmlTag', ['tag' => 'tr']]], 'elements' => ['usCongressional'], ] ], ] ); $this->addDecorator( ['tbodyClose' => 'HtmlTag'], ['tag' => 'tbody', 'closeOnly' => true, 'placement' => DecoratorAbstract::APPEND] ); $this->addDecorator( ['table' => 'HtmlTag'], ['tag' => 'table', 'class' => 'table table-bordered table-striped'] ); $this->addDecorator('DtDdWrapper'); } return $this; } }