$actions = array(
'EDIT' => sprintf('<a href="admin-ajax.php?action=%s&subaction=%s&course_id=%d" class="%s" id="%s">Edit</a>',
'abf_cm',
'edit_course',
$item['course_id'],
'thickbox edit-box',
'edit_'.$item['course_id']
),
'DELETE' => sprintf('<a href="?page=%s&task=%s&action=%s&bookid=%s&noheader=true">Delete</a>','course_management','do_process','delete',$item['course_id']),
);
In doing so, the edit part is not being displayed.Am i doing anything wrong.
I also tried using the placeholders
'EDIT' => sprintf('<a href="admin-ajax.php?action=%1$s&subaction=%2$s&course_id=%4$d" class="%4$s" id="%5$s">Edit</a>',
'abf_cm',
'edit_course',
$item['course_id'],
'thickbox edit-box',
'edit_'.$item['course_id']
),
but still no results. I also noticed that when i remove the class and id attributes in the earlier version, then it works fine.
Can you please give me a satisfactory explanation of this and tell me where am i doing wrong.
EDIT:
Im using this inside WordPress for creating custom table using WP_List_Table class
function column_course_name($item ) {
//Build row actions
$actions = array(
'EDIT' => sprintf('<a href="admin-ajax.php?action=%s&subaction=%s&course_id=%d" class="%s" id="%s">Edit</a>',
'abf_cm',
'edit_course',
$item['course_id'],
'thickbox edit-box',
'edit_'.$item['course_id']
),
'DELETE' => sprintf('<a href="?page=%s&task=%s&action=%s&bookid=%s&noheader=true">Delete</a>','book_management','do_process','delete',$item['course_id']),
);
//Return the title contents
return sprintf('<a href="?page=book_management&action=viewnedit&bookid=%2$s">%1$s</a>%3$s',
/*$1%s*/ strlen($item['course_name'])>0?$item['course_name']:'<span style="color:silver">(No Name)</span>',
/*$2%s*/ $item['course_id'],
/*$3%s*/ $this->row_actions($actions) //row_actions is a method in this class
);
}
update:
Well, its strange to mention but the code works when i use a single class( ie when i delete the space between the two classes for the tag) .
Any thoughts?
Dipesh, maybe you have errors in the code around this snippet.
Try to check your code in isolation. I copied your code to the separate .php script with little set-up and checked
$actionsarray withprint_r, like this:edit_array.php
I ran this script from console and got the following results:
Generated link for
$actions['EDIT']is HTML valid, so one can safely conclude that your code itself is working fine, and error lies somewhere else.