将图标添加到 Drupal 7 打印功能
Adding Icons to Drupal 7 print function
foreach ($result as $row) {
$rows[] = array(
$i,
$row->country_name,
$status = ($row->status == 0) ? 'Inactive' : 'Active',
date('d-m-Y H:i:s', strtotime($row->added_date)),
l('Edit', 'mypages/countries/'. $row->id),
l('Delete', 'mypages/delete/'. $row->country_name)
);
$i++;
}
在上面的函数中有编辑和删除链接,我需要为这两个edit and delete
添加相关的fa图标...
我试过在下面这样添加
l('<i class="fa fa-edit"></i>Edit', 'mypages/countries/'. $row->id),
l('<i class="fa fa-trash"></i>Delete', 'mypages/delete/'. $row->country_name)
按照上面的图标不工作有没有其他方法可以继续
l()
函数默认会转义所有HTML。您需要传递包含 HTML 的第三个参数。这是正确的代码:
l('<i class="fa fa-edit"></i>Edit', 'mypages/countries/'. $row->id, array('html' => TRUE)),
l('<i class="fa fa-trash"></i>Delete', 'mypages/delete/'. $row->country_name, array('html' => TRUE))
foreach ($result as $row) {
$rows[] = array(
$i,
$row->country_name,
$status = ($row->status == 0) ? 'Inactive' : 'Active',
date('d-m-Y H:i:s', strtotime($row->added_date)),
l('Edit', 'mypages/countries/'. $row->id),
l('Delete', 'mypages/delete/'. $row->country_name)
);
$i++;
}
在上面的函数中有编辑和删除链接,我需要为这两个edit and delete
添加相关的fa图标...
我试过在下面这样添加
l('<i class="fa fa-edit"></i>Edit', 'mypages/countries/'. $row->id),
l('<i class="fa fa-trash"></i>Delete', 'mypages/delete/'. $row->country_name)
按照上面的图标不工作有没有其他方法可以继续
l()
函数默认会转义所有HTML。您需要传递包含 HTML 的第三个参数。这是正确的代码:
l('<i class="fa fa-edit"></i>Edit', 'mypages/countries/'. $row->id, array('html' => TRUE)),
l('<i class="fa fa-trash"></i>Delete', 'mypages/delete/'. $row->country_name, array('html' => TRUE))