Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ad7ef77
Code standards: Lay out array according to coding styles, for legibil…
mapkyca Mar 25, 2018
56df56b
Add filename to attachment array, so that we can identify files for r…
mapkyca Mar 25, 2018
fc76288
Handle multiple photo attachments on a Photo object
mapkyca Mar 26, 2018
914fdf6
Restore old "replace" functionality, while working on a better UX
mapkyca Mar 26, 2018
9b0d629
Support for multiple photo thumbnails on Photo
mapkyca Mar 26, 2018
9c6bd2c
Adding generic image file form control with preview
mapkyca Mar 26, 2018
94e0906
Tidying up from old image code
mapkyca Mar 26, 2018
4068ab4
Preview no longer hides the preview image
mapkyca Mar 26, 2018
e1a98f6
Fixing add new entry orientation
mapkyca Mar 26, 2018
dcadbfc
Ability to add more and multiple image files
mapkyca Mar 26, 2018
9b9f32a
Adding some helper html counters
mapkyca Mar 26, 2018
088747a
Adding lightbox hooks for gallery grouping
mapkyca Mar 26, 2018
f741f03
Nicer CSS style guidelines for multiple images
mapkyca Mar 26, 2018
11949d7
Nice feed gallery view
mapkyca Mar 26, 2018
4d93a78
Better CSS for multiple edit of images
mapkyca Mar 26, 2018
ef19fa0
Better CSS for multiple edit of images
mapkyca Mar 26, 2018
8525e0d
Security: Ensure that we are able to edit an object before we delete it.
mapkyca Mar 26, 2018
a787968
Adding a mechanism to remove an individual attachment
mapkyca Mar 26, 2018
aba4e21
Adding an endpoint to remove a specific attachment from an object.
mapkyca Mar 26, 2018
797a953
Fixing delete attachment method
mapkyca Mar 26, 2018
4e6b5a4
Fixing delete mechanism
mapkyca Mar 26, 2018
98c147f
Mechanism for deleting photos
mapkyca Mar 26, 2018
69109dc
Mechanism for deleting photos
mapkyca Mar 26, 2018
4ab16b2
Support new thumbnail format in JSON array
mapkyca Mar 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding a mechanism to remove an individual attachment
  • Loading branch information
mapkyca committed Mar 26, 2018
commit a78796860bf03965a1c1200351dc4f375ccb6125
20 changes: 20 additions & 0 deletions Idno/Common/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,26 @@ function deleteAttachments()
$this->attachments = [];
}
}

/**
* Delete a single attachment by its id
* @param type $id
*/
function deleteAttachment($id) {
if ($attachments = $this->getAttachments()) {
foreach ($attachments as $key => $attachment) {
if ($id == $attachment['_id']) {
if ($file = \Idno\Entities\File::getByID($attachment['_id'])) {
$file->delete();
}
}

unset($attachments[$key]);
}

$this->attachments = $attachments;
}
}

/**
* Returns an array of attachments to this entity.
Expand Down