# Using Foundation Icons in View Actions

**URL:** <https://discourse.cakephp.org/t/using-foundation-icons-in-view-actions/6659>\
**Category:** Need Help\
**Created:** [September 23, 2019, 8:38am UTC](https://discourse.cakephp.org/t/using-foundation-icons-in-view-actions/6659 "2019-09-23T08:38:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jmacnz](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jmacnz](https://discourse.cakephp.org/u/Jmacnz)\
**Post date:** [September 23, 2019, 8:38am UTC](https://discourse.cakephp.org/t/using-foundation-icons-in-view-actions/6659/1 "2019-09-23T08:38:44Z")

</div>

I am using 3.8 and have included the foundation font icon file into the css, these load ok and are available in the views, however the View and Edit functions work as expected using the following:

\<?= $this-\>Html-\>link(\_\_(''), ['action' =\> 'view', $category-\>id],['class' =\> 'fi-zoom-in size-18', 'escape' =\> false]); ?\>

Unfortunately trying to use something similar in the delete line results in the icon being shown which will immediately delete the row in question, the Confirm question seems to get bypassed?  
I have tried every variation of this:

\<?= $this-\>Form-\>postLink(\_\_(''), ['action' =\> 'delete', $category-\>id], ['class' =\> 'fi-trash size-18', 'escape' =\> false],['confirm' =\> \_\_('Are you sure you want to delete # {0}?', $category-\>id)]) ?\>

I have tried every variation of this that I can think of to no avail.

I have found using the following code it wil work:  
\<?= $this-\>Form-\>postLink(  
$this-\>Html-\>image(  
“fi-trash.svg”,  
[‘class’ =\> ‘SvgImage’],  
[“alt” =\> \_\_(‘Delete’)]  
),  
[‘action’ =\> ‘delete’, $category-\>id],  
[‘escape’ =\> false, ‘confirm’ =\> \_\_(‘Are you sure you want to delete this category?’, $category-\>id)]  
)?\>

but it would be nice to use a font icon instead? The SvgImage class merely sets the svg img to 10%

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [September 23, 2019, 2:35pm UTC](https://discourse.cakephp.org/t/using-foundation-icons-in-view-actions/6659/2 "2019-09-23T14:35:24Z")

</div>

`class`, `escape` and `confirm` are all things that need to go in the `$options` array together. You’ve got the `confirm` moved into a separate array for some reason.

---

<div class="post-metadata">

**Author:** ![Jmacnz](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jmacnz](https://discourse.cakephp.org/u/Jmacnz)\
**Post date:** [September 23, 2019, 8:19pm UTC](https://discourse.cakephp.org/t/using-foundation-icons-in-view-actions/6659/3 "2019-09-23T20:19:34Z")

</div>

Thanks Zuluru worked like a charm, that must have been the only combination I failed to try, i’ll pay more attention to the square brackets in future 😄

---

<div class="post-metadata">

**Author:** ![Jmacnz](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jmacnz](https://discourse.cakephp.org/u/Jmacnz)\
**Post date:** [September 24, 2019, 3:37am UTC](https://discourse.cakephp.org/t/using-foundation-icons-in-view-actions/6659/4 "2019-09-24T03:37:25Z")

</div>

After Zuluru’s advice I also found this alternative:

\<?= $this-\>Html-\>link('', ['controller' =\> 'categories', 'action' =\> 'view', $category-\>id], ['escape' =\> false]); ?\>

which seems to be clearer to read 🙂

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [September 24, 2019, 4:40am UTC](https://discourse.cakephp.org/t/using-foundation-icons-in-view-actions/6659/5 "2019-09-24T04:40:19Z")

</div>

Please make sure that you understand the difference between `link` and `postLink`. They are different things, for different purposes. Both take parameters the same way.

---

<div class="post-metadata">

**Author:** ![Jmacnz](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jmacnz](https://discourse.cakephp.org/u/Jmacnz)\
**Post date:** [September 24, 2019, 5:11am UTC](https://discourse.cakephp.org/t/using-foundation-icons-in-view-actions/6659/6 "2019-09-24T05:11:29Z")

</div>

Thanks Zuluru

I think I have it, the link does just that creates a link to some action whereas the postLink creates a form via javascript? I was struggling to get the system to just display the font icon 🙂

Thanks again.
