/** * Adds the necessairy fields to the form of this table * @return null */ protected function prepareForm() { $factory = FieldFactory::getInstance(); if ($this->hasActions()) { $options = $this->getOptionsFromKeys($this->actions); $translator = I18n::getInstance()->getTranslator(); array_unshift($options, $translator->translate(self::TRANSLATION_ACTIONS)); $actionField = $this->createListField($factory, $options, self::FIELD_ACTION); $idField = $factory->createField(FieldFactory::TYPE_OPTION, self::FIELD_ID); $idField->setIsMultiple(true); $idField->setOptions($this->values); $this->form->addField($actionField); $this->form->addField($idField); } if ($this->hasSearch()) { $searchQueryField = $factory->createField(FieldFactory::TYPE_STRING, self::FIELD_SEARCH_QUERY, $this->searchQuery); $this->form->addField($searchQueryField); } if ($this->hasOrderMethods()) { $options = $this->getOptionsFromKeys($this->orderMethods); $orderField = $this->createListField($factory, $options, self::FIELD_ORDER_METHOD, $this->orderMethod); $this->form->addField($orderField); } if ($this->paginationOptions) { $pageItemsField = $this->createListField($factory, $this->paginationOptions, self::FIELD_PAGE_ROWS, $this->pageRows); $this->form->addField($pageItemsField); } }