I am currently overriding Joomla 3's deleteList like so:
public function delete(){
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
$path = JPATH_ROOT;
$path = JPath::clean($path. DS ."images". DS ."menu_slider". DS );
foreach(glob($path.'*/penguins.*') as $image){
unlink($image);
}
return parent::delete();
}
In the item or items there's a image associated with them, so the database has the following:
id title image
So my question really is how would i get the image name assigned to the item or items when deleting?
Probably you're aware that controller triggers model method delete, then it load JTable which deletes the entry. My suggestion would be to extend JTable class with following method in /administrator/components/com_YourExtension/tables/YourTableFile.php :
public function delete($pk = null)
{
jimport( 'joomla.filesystem.file' );
$path = JPath::clean(JPATH_ROOT . "/images/menu_slider/");
if (JFile::exists($path . $this->image)
JFile::delete($path . $this->image);
return parent::delete($pk);
}