Permalink
Browse files

Nodeslist columns metadata

  • Loading branch information...
1 parent ba7950e commit f4452db58df8b55a306b8d4566dc04c20e545148 @cdujeu cdujeu committed Sep 30, 2016
Showing with 13 additions and 3 deletions.
  1. +13 −3 core/src/plugins/core.access/src/Model/NodesList.php
@@ -135,9 +135,14 @@ public function toXML()
$this->paginationData["dirs"],
$this->paginationData["remoteSort"]);
}
+ $messages = LocaleService::getMessages();
if(isSet($this->columnsDescription)){
$xmlChildren = [];
foreach($this->columnsDescription['columns'] as $column){
+ if(!isSet($messages[$column["messageId"]])){
+ $column["messageString"] = $column["messageId"];
+ unset($column["messageId"]);
+ }
$xmlChildren[] = XMLHelper::toXmlElement("column", $column);
}
$xmlConfig = XMLHelper::toXmlElement("columns", $this->columnsDescription['description'], implode("", $xmlChildren));
@@ -174,15 +179,20 @@ public function initColumnsData($switchGridMode='', $switchDisplayMode='', $temp
* @param string $attributeName
* @param string $sortType
* @param string $width
+ * @param array $additionalMeta
* @return $this
*/
- public function appendColumn($messageId, $attributeName, $sortType='String', $width=''){
- $this->columnsDescription['columns'][] = [
+ public function appendColumn($messageId, $attributeName, $sortType='String', $width='', $additionalMeta = []){
+ $col = [
'messageId' => $messageId,
'attributeName' => $attributeName,
'sortType' => $sortType,
'width' => $width
];
+ foreach($additionalMeta as $k => $v){
+ $col[$k] = $v;
+ }
+ $this->columnsDescription['columns'][] = $col;
return $this;
}
@@ -252,7 +262,7 @@ public function render($output)
if(isSet($this->columnsDescription["columns"])){
$messages = LocaleService::getMessages();
foreach($this->columnsDescription["columns"] as $column){
- $colTitle = $messages[$column["messageId"]];
+ $colTitle = isSet($messages[$column["messageId"]]) ? $messages[$column["messageId"]] : $column["messageId"];
$collAttr = $column["attributeName"];
$headers[$collAttr] = $colTitle;
}

0 comments on commit f4452db

Please sign in to comment.