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,12 +3,13 @@
|
|||||||
/*
|
/*
|
||||||
* Chill is a software for social workers
|
* 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
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@ -92,8 +93,13 @@ class CustomFieldText implements CustomFieldInterface
|
|||||||
|
|
||||||
public function render($value, CustomField $customField, $documentType = 'html')
|
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
|
return $this->templating
|
||||||
->render('ChillCustomFieldsBundle:CustomFieldsRendering:text.html.twig', array('text' => $value));
|
->render($template, array('text' => $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function serialize($value, CustomField $customField)
|
public function serialize($value, CustomField $customField)
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
{%- for choice in choices -%}
|
{%- for choice in choices -%}
|
||||||
{% if choice['slug'] in selected %}
|
{% if choice['slug'] in selected %}
|
||||||
{%- if choice['slug'] is not same as('_other') -%}
|
{%- if choice['slug'] is not same as('_other') -%}
|
||||||
{{ choice['name']|localize_translatable_string }}
|
{{ choice['name']|localize_translatable_string|replace({'"':'""'})|raw }}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ choice['name'] }}
|
{{ choice['name']|replace({'"':'""'})|raw }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endfor -%}
|
{%- 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