ez projects / sqliimport / forum / general / how to remove an ezmatrix l...
You need to be logged in to post messages in the forums. New users may register here.
|
Member since: Posts: 6 |
Thursday 02 February 2012 5:10:58 pm Hello Jérôme,
I import some data in an ezmatrix datatype. But if the ezmatrix is empty in the new import, the old value stay... I tried $content->fields->dates_ouverture = " "; but it creates an empty line in my ezmatrix field (and in my website it display some empty data...) Do you know how to owerite the value of a ezmatrix field ??? Thank you |
|
Member since: Posts: 98 |
Wednesday 15 February 2012 2:21:31 pm Hi Solène and sorry for the late reply...
This is due to how eZMatrix datatype handles strings input. kernel/classes/datatypes/ezmatrix/ezmatrixtype.php function fromString( $contentObjectAttribute, $string ) { if ( $string != '' ) { $matrix = $contentObjectAttribute->attribute( 'content' ); $matrixRowsList = eZStringUtils::explodeStr( $string, "&" ); $cells = array(); $matrix->Matrix['rows']['sequential'] = array(); $matrix->NumRows = 0; foreach( $matrixRowsList as $key => $value ) { $newCells = eZStringUtils::explodeStr( $value, '|' ); $matrixArray[] = $newCells; $cells = array_merge( $cells, $newCells ); $newRow['columns'] = $newCells; $newRow['identifier'] = 'row_' . ( $matrix->NumRows + 1 ); $newRow['name'] = 'Row_' . ( $matrix->NumRows + 1 ); $matrix->NumRows++; $matrix->Matrix['rows']['sequential'][] = $newRow; } $matrix->Cells = $cells; } return true; } Unfortunately, this implementation forces you to always have a line :-(. Maybe you should open an issue in eZPublish issue tracker and make a pull request ? ;-) My Blog (french) : http://www.lolart.net |
You need to be logged in to post messages in the forums. New users may register here.