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:
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%
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.
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.
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