diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-23 20:21:59 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-23 20:21:59 +0200 |
commit | 275785bef739bc3959cd7b1c671e53a30355c897 (patch) | |
tree | baa065ac3f601bf3ee5de7f093fa265b77a8c01f | |
parent | b9451ccf0ed90c674c6f714de10a71a33a6c7b16 (diff) | |
download | chd_gestion-275785bef739bc3959cd7b1c671e53a30355c897.zip chd_gestion-275785bef739bc3959cd7b1c671e53a30355c897.tar.gz chd_gestion-275785bef739bc3959cd7b1c671e53a30355c897.tar.bz2 |
bake : more for limit action links to defined controller methods
-rw-r--r-- | fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig | 4 | ||||
-rw-r--r-- | fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig index 9c7437e..1bb6bb5 100644 --- a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig +++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig @@ -108,7 +108,11 @@ $this->Form->setTemplates(['label' => '']); {% if associations.BelongsTo %} {% for alias, details in associations.BelongsTo if field == details.foreignKey %} {% set isKey = true %} +{% if BakeExtra.hasAction('view', details.controller) %} <td><?= ${{ singularVar }}->has('{{ details.property }}') ? $this->Html->link(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}, ['controller' => '{{ details.controller }}', 'action' => 'view', ${{ singularVar }}->{{ details.property }}->{{ details.primaryKey[0] }}]) : '' ?></td> +{% else %} + <td><?= ${{ singularVar }}->has('{{ details.property }}') ? h(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}) : '' ?></td> +{% endif %} {% endfor %} {% endif %} {% if isKey is not same as(true) %} diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig index d56588e..a5563bf 100644 --- a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig +++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/view.twig @@ -86,7 +86,11 @@ {% set details = associationFields[field] %} <tr> <th scope="row"><?= __('{{ details.property|humanize }}') ?></th> +{% if BakeExtra.hasAction('view', details.controller) %} <td><?= ${{ singularVar }}->has('{{ details.property }}') ? $this->Html->link(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}, ['controller' => '{{ details.controller }}', 'action' => 'view', ${{ singularVar }}->{{ details.property }}->{{ details.primaryKey[0] }}]) : '' ?></td> +{% else %} + <td><?= ${{ singularVar }}->has('{{ details.property }}') ? h(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}) : '' ?></td> +{% endif %} </tr> {% else %} <tr> @@ -100,7 +104,11 @@ {% for alias, details in associations.HasOne %} <tr> <th scope="row"><?= __('{{ alias|underscore|singularize|humanize }}') ?></th> +{% if BakeExtra.hasAction('view', details.controller) %} <td><?= ${{ singularVar }}->has('{{ details.property }}') ? $this->Html->link(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}, ['controller' => '{{ details.controller }}', 'action' => 'view', ${{ singularVar }}->{{ details.property }}->{{ details.primaryKey[0] }}]) : '' ?></td> +{% else %} + <td><?= ${{ singularVar }}->has('{{ details.property }}') ? h(${{ singularVar }}->{{ details.property }}->{{ details.displayField }}) : '' ?></td> +{% endif %} </tr> {% endfor %} {% endif %} |