diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-21 23:52:44 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-21 23:52:44 +0200 |
commit | 748b7bf7c5c4df2d546ae375d9c13b5657e431df (patch) | |
tree | 35ac11de286bdfe4b6e243e2eb05b52992b6f420 /fai_gestion/plugins/CustomTheme/src/Template/Bake/Model | |
parent | 38fc194ababe7e1876a27697a9beb6d21623dcd6 (diff) | |
download | chd_gestion-748b7bf7c5c4df2d546ae375d9c13b5657e431df.zip chd_gestion-748b7bf7c5c4df2d546ae375d9c13b5657e431df.tar.gz chd_gestion-748b7bf7c5c4df2d546ae375d9c13b5657e431df.tar.bz2 |
bake: implement virtual entity titles
Diffstat (limited to 'fai_gestion/plugins/CustomTheme/src/Template/Bake/Model')
-rw-r--r-- | fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig index aaa15e5..527a30b 100644 --- a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig +++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/entity.twig @@ -76,7 +76,27 @@ class {{ name }} extends Entity protected $_hidden = [{{ Bake.stringifyList(hidden)|raw }}]; {% endif %} -{%- if not accessible and not hidden %} +{%- if virtualTitleCustomCode or virtualTitlePieces %} + /** + * Virtual fields to be exposed (serialized) + */ + protected $_virtual = ['title']; + + /** + * Virtual field for pretty print in related table's views + * + * @return String + */ + protected function _getTitle() + { +{%- if virtualTitleCustomCode %} + +{{ virtualTitleCustomCode|raw }} +{% else %} + + return "{{ virtualTitlePrefix }}" . implode("{{ virtualTitleGlue??' ' }}", [{{ Bake.stringifyList(virtualTitlePieces, { indent:3, quotes: false } )|raw }}]); +{% endif %} + } {% endif %} } |