/** * @param ServiceLocatorInterface $sm */ public function __construct($categoryId) { parent::__construct('apartment-review-category-form'); $this->setAttribute('class', 'form-horizontal'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'name', 'attributes' => array('type' => 'text', 'class' => 'form-control', 'id' => 'name'))); $this->add(array('name' => 'type', 'type' => 'Zend\\Form\\Element\\Select', 'options' => array('value_options' => Objects::getApartmentReviewCategoryStatus()), 'attributes' => array('class' => 'form-control', 'id' => 'type'))); $this->add(array('name' => 'save', 'attributes' => array('type' => 'submit', 'class' => 'btn btn-primary state save-bank-account col-sm-2 col-xs-12 margin-left-10 pull-right', 'value' => $categoryId > 0 ? 'Save Changes' : 'Add New Code'))); }
/** * @param \DDD\Domain\Apartment\ReviewCategory[]|\ArrayObject * @return array */ private function prepareData($reviewCategoryList) { $data = []; if ($reviewCategoryList->count()) { foreach ($reviewCategoryList as $reviewCategory) { $router = $this->getServiceLocator()->get('router'); $editUrl = $router->assemble(['controller' => 'apartment-review-category', 'action' => 'edit', 'id' => $reviewCategory['id']], ['name' => 'backoffice/default']); array_push($data, [$reviewCategory['name'], Objects::getApartmentReviewCategoryStatus()[$reviewCategory['type']], '<a class="btn btn-xs btn-primary" href="' . $editUrl . '" data-html-content="Edit"></a>']); } } return $data; }