Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8496479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:51:59+00:00 2026-06-10T23:51:59+00:00

We customized the News Item-type and replaced the embedded image with an ExtendedReferenceField (we

  • 0

We customized the News Item-type and replaced the embedded image with an ExtendedReferenceField (we use a central image repository).

Is there a way to activate link integrity checking on that field so that when one tries to delete the image a warning is triggered?

(Yes, link integrity checking is enabled in @@editing-controlpanel and works just fine when I insert links and images in the content body).

Condensed code for the schemaextender field used:

from zope.interface import implements
from archetypes.schemaextender.interfaces import ISchemaExtender
from archetypes.schemaextender.interfaces import IBrowserLayerAwareExtender
from archetypes.schemaextender.field import ExtensionField
from Products.Archetypes import atapi
from archetypes.referencebrowserwidget.widget import ReferenceBrowserWidget

class ExtendedReferenceField(ExtensionField, atapi.ReferenceField):
    """ Extention reference field. """

class ImageReferenceExtender(object):
    implements(ISchemaExtender, IBrowserLayerAwareExtender)

    layer = IPackageSpecific

    fields = [
        ExtendedReferenceField(
            name= 'imageref',
            required = False,
            multiValued=False,
            allowed_types=('Image', ),
            relationship='image',
            keepReferencesOnCopy=True,
            widget = ReferenceBrowserWidget(
                ...
                )),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields

This happens in Plone version 3.3.6 as well as 4.1.6.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:52:00+00:00Added an answer on June 10, 2026 at 11:52 pm

    Link integrity works by adding references named isReferencing between objects, but it only does this for HTML links within TextFields, whenever an object is modified.

    To support individual reference fields, you have 2 options:

    1. Add isReferencing relationships whenever you add your image relationship, remove them again when the image relationship is gone, using events or the extender. Link integrity will then kick in.

    2. Track the removal of an image relationship as an integrity breach. You’d need to check if the referring object is being removed.

      Take a look at the handlers.py module of the plone.app.linkintegrity package. The referenceRemoved event handler is called whenever any Archetypes reference is deleted. It updates the ILinkIntegrityInfo storage, adding both source and target of a isReferencing relationship, and this storage is consulted when handling content object deletion.

      Create a new event handler for your image reference and it’ll be handled in the same way; delete a referenced image and the link integrity warning will be raised:

      from plone.app.linkintegrity.interfaces import ILinkIntegrityInfo
      from Products.Archetypes.interfaces import IReference
      from Acquisition import aq_get
      
      def imageReferenceRemoved(obj, event):
          assert IReference.providedBy(obj)
          assert obj is event.object # just making sure...
          if not obj.relationship == 'image':
              return
          # if the object the event was fired on doesn't have a `REQUEST` attribute
          # we can safely assume no direct user action was involved and therefore
          # never raise a link integrity exception...
          request = aq_get(obj, 'REQUEST', None)
          if not request:
              return
          storage = ILinkIntegrityInfo(request)
          storage.addBreach(obj.getSourceObject(), obj.getTargetObject())
      

      registered with ZCML:

       <configure xmlns="http://namespaces.zope.org/zope">
       <subscriber
           for="Products.Archetypes.interfaces.IReference
                zope.lifecycleevent.interfaces.IObjectRemovedEvent"
           handler=".events.imageReferenceRemoved"
           />
       </configure>
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have customized UIButton with the following properties: 84x44 frame 84x44 background image 32*32
I made a customized template called node-mynode.tpl.php Whenever a node of type mynode is
I have a customized UISlider which has its track image disappear sometimes. It happens
There was an Apple-customized version of pngcrush in every version of Xcode before 4.3.
I have customized the button in this way: <Button BorderBrush=Transparent Name=DialButton Click=DialButton_Click > <StackPanel
I write my customized lookupedit(derived from lookupedit) I want to use it in lookupeditsettings
i have this customized list. each row contains an image and two lines of
I have a customized device made by myself, and I want to use iOS
I've customized my Custom UINavigationBar to show a custom image (actually I crossfade between
I customized the content module so the title of an article displays an image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.