when a user deletes an object referenced by a tile we need to show a warning message like this: "This item is used by xxxxxxxx frontage. Delete it anyway?"
FWIW: Any issue like this which can cause a catastrophic failure (collective cover breaking because of missing reference) should be considered not only a bug but something more catastrophic (maybe "hardfail" ;-); in that a user will report a broken page
First some things should be clarified and defined before implement this.
p.a.linkintegrity work this way: every time an object is created, modified, removed, it tries to find TextField or dexterity RichText field to extract the links inside it... then it uses those links, the internal ones, to create relations between the target object and the object than fired the event.
p.a.linkintegrity and tiles: tiles aren't objects, they don't fire any event on modification because even persistent tiles just modify annotations on the parent object, in out case the cover, and modifications to annotations on the parent cover doesn't fire a modified event neither.
I think than the following should be done:
collective.cover tiles fire ObjectModifiedEvent every time a tile is modified, as you can see here:
for the other stuff, I would love to wait for @runyaga comments, but I don't think putting stuff for tiles inside p.a.linkintegrity is a good idea...
maybe cover tiles need to grow link integrity feature? and there is a cover utility which subscribes to IObjectRemovedEvent to compare if an item pending removal has a UUID that cover references. It is only the REmoveEvent that should be cared about -- iirc
@hvelarde you are right, base class is firing events in several places, but I think than that could be better handled by data manager... that way every tile will have linkintegrity support...
@runyaga we don't need to listen to IObjectRemovedEvent because that its already handled by linkintegrity, we only need to add the references... that could be done into the datamanager or into linkintegrity... we have now a really specific code to get the references (https://github.com/plone/plone.app.linkintegrity/blob/master/plone/app/linkintegrity/handlers.py#L174)... we can have that kind of handler for tiles... an then we store the references between the target of the link and the parent object of the tile, because the tile isn't an object, in our case the parent is the cover... doing that its simple, just try to remove the target and Plone will warn you about the broken link...
Link integrity support, close #35
we need to implement this for any tile referencing an object, not only on RichText tiles; according to @ericof there could be a potential issue on p.a.blocks: if a user just deletes the object ignoring the message we could have a broken cover.
Implement upgrade step (refs. #35)