mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 14:24:24 +00:00
export raw string (no html conversion) and replace " by "" - refs #401
This commit is contained in:
parent
47a9a29236
commit
b40a1595c1
@ -3,7 +3,8 @@
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
@ -92,8 +93,13 @@ class CustomFieldText implements CustomFieldInterface
|
||||
|
||||
public function render($value, CustomField $customField, $documentType = 'html')
|
||||
{
|
||||
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:text.html.twig';
|
||||
if($documentType == 'csv') {
|
||||
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:text.csv.twig';
|
||||
}
|
||||
|
||||
return $this->templating
|
||||
->render('ChillCustomFieldsBundle:CustomFieldsRendering:text.html.twig', array('text' => $value));
|
||||
->render($template, array('text' => $value));
|
||||
}
|
||||
|
||||
public function serialize($value, CustomField $customField)
|
||||
|
@ -2,9 +2,9 @@
|
||||
{%- for choice in choices -%}
|
||||
{% if choice['slug'] in selected %}
|
||||
{%- if choice['slug'] is not same as('_other') -%}
|
||||
{{ choice['name']|localize_translatable_string }}
|
||||
{{ choice['name']|localize_translatable_string|replace({'"':'""'})|raw }}
|
||||
{%- else -%}
|
||||
{{ choice['name'] }}
|
||||
{{ choice['name']|replace({'"':'""'})|raw }}
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- endfor -%}
|
||||
|
1
Resources/views/CustomFieldsRendering/text.csv.twig
Normal file
1
Resources/views/CustomFieldsRendering/text.csv.twig
Normal file
@ -0,0 +1 @@
|
||||
{% if text is not empty %}{{ text|replace({'"':'""'})|raw }}{% else %}{{ 'None'|trans }}{% endif %}
|
Loading…
x
Reference in New Issue
Block a user