0

I have a form that when originally submitted, it goes into a page where a user can "preview" the item before posting it to the site. I have these 3 links, but I would like to change it from the default text links to image buttons that they can click on to perform these tasks.

  <?php echo link_to('Edit', 'ticket_edit', $ticket) ?>
  <?php echo link_to('Purchase', 'ticket_publish', $ticket, array('method' => 'put')) ?>
  <?php echo link_to("Cancel", 'ticket_delete', $ticket, array('method' => 'delete', 'confirm' => 'Are you sure you want to delete the item?')) ?>

So instead of "edit", "publish", and "cancel", I want it to display an image for each.

GoRivera
  • 173
  • 1
  • 13

2 Answers2

2

You can use

<?php echo link_to( image_tag( '<your image name>' ), 'ticket_edit', $ticket) ?>

and so on for the other links...

ilSavo
  • 854
  • 1
  • 8
  • 28
0

You can use button_to ($name, $internal_uri, $options) (Symfony docs)

<?php echo button_to('Edit', 'ticket_edit', $ticket) ?>

but you cannot use an image as a button. However, this SO answer will give you a function you can use to get what you need.

Community
  • 1
  • 1
qais
  • 1,808
  • 3
  • 20
  • 31