Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Button Extension - HTML in buttons text property #629

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Resources/views/datatable/button.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
namespace: "{{ button.namespace }}",
{% endif %}
{% if button.text is defined and button.text is not same as(null) %}
text: "{{ button.text }}",
text: "{{ button.text|e('js') }}",
{% endif %}
{% if button.titleAttr is defined and button.titleAttr is not same as(null) %}
titleAttr: "{{ button.titleAttr }}",
Expand Down
13 changes: 13 additions & 0 deletions Response/DatatableFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ public function runFormatter(Paginator $paginator, DatatableInterface $datatable
$row[$data] = $row[$dql];
unset($row[$dql]);
}
}
else if(false === $this->accessor->isReadable($row, $path))
{
// Set empty values for the path of an association without object
$pathParts = explode('.', $column->getData());
$buildPath = '';
foreach($pathParts as $part)
{
if(false === $this->accessor->isReadable($row, $buildPath.'['.$part.']'))
$this->accessor->setValue($row, $buildPath, array($part => null));

$buildPath .= '['.$part.']';
}
}
}

Expand Down