/** * @test */ public function getByArray() { $cell = new Tx_PtExtlist_Domain_Model_List_Cell(); $cell->setValue('testValue'); $cell->setRowIndex(1); $cell->setColumnIndex(2); $cell->addSpecialValue('key1', 'value1'); $cell->setCSSClass('testCssClass'); $this->assertEquals($this->testDataArray, $cell->getAsArray()); }
/** * Renders the cell content. * * @param \Tx_PtExtlist_Domain_Configuration_ColumnConfigInterface $columnConfig * @param Tx_PtExtlist_Domain_Model_List_Row $data The table data. * @param integer $columnIndex Current column index. * @param integer $rowIndex Current row index. * * @internal param string $columnIdentifier The columnIdentifier. * @return Tx_Pt_extlist_Domain_Model_List_Cell */ public function renderCell(Tx_PtExtlist_Domain_Configuration_ColumnConfigInterface $columnConfig, Tx_PtExtlist_Domain_Model_List_Row $data, $columnIndex, $rowIndex) { // Load all available fields $fieldSet = $this->createFieldSet($data, $columnConfig); $caching = $columnConfig->getCacheRendering() || $this->configurationBuilder->buildListConfiguration()->getCacheRendering(); // TODO: Include the objectMapper here ... // if($columnConfig->getObjectMapperConfig() instanceof Tx_PtExtlist_Domain_Configuration_Columns_ObjectMapper_ObjectMapperConfig) {} if ($columnConfig->getRawFields()) { $content = $fieldSet; } else { $content = Tx_PtExtlist_Utility_RenderValue::renderByConfigObject($fieldSet, $columnConfig, $caching); } // Create new cell $cell = new Tx_PtExtlist_Domain_Model_List_Cell($content); $cell->setRowIndex($rowIndex); $cell->setColumnIndex($columnIndex); // render cell css class if ($columnConfig->getCellCSSClass()) { $cell->setCSSClass($this->renderCellCSSClass($fieldSet, $columnConfig)); } return $cell; }
/** * @param array $rowData * @return Tx_PtExtlist_Domain_Model_List_Row */ protected function createRowFromTestData(array $rowData) { $row = new Tx_PtExtlist_Domain_Model_List_Row(); $row->setSpecialValues($rowData['specialValues']); foreach ($rowData['columns'] as $key => $testCell) { $cell = new Tx_PtExtlist_Domain_Model_List_Cell($testCell['value']); $cell->setCSSClass($testCell['cssClass']); $cell->setColumnIndex($testCell['columnIndex']); $cell->setRowIndex($testCell['rowIndex']); $cell->addSpecialValue('key1', $testCell['specialValues']['key1']); $row->addCell($cell, $key); } return $row; }