Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way to extend Plone Dexterity's INameFromTitle behavior?
    primarykey
    data
    text
    <p>The project I am working on uses Plone's awesome Dexterity plugin. A couple of my custom content types have very specific names that must be computed. The way I had originally accomplished this before was by adding <em>plone.app.content.interfaces.INameFromTitle</em> as a behavior in the object's generic setup entry, per the manual's directions:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;object name="avrc.aeh.cycle" meta_type="Dexterity FTI"&gt; ... &lt;property name="schema"&gt;myproject.mytype.IMyType&lt;/property&gt; &lt;property name="klass"&gt;plone.dexterity.content.Item&lt;/property&gt; ... &lt;property name="behaviors"&gt; &lt;element value="plone.app.content.interfaces.INameFromTitle" /&gt; &lt;/property&gt; ... &lt;/object&gt; </code></pre> <p>Then I created an adapter that would provide INameFromTitle:</p> <pre><code>from five import grok from zope.interface import Interface import zope.schema from plone.app.content.interfaces import INameFromTitle class IMyType(Interface): foo = zope.schema.TextLine( title=u'Foo' ) class NameForMyType(grok.Adapter): grok.context(IMyType) grok.provides(INameFromTitle) @property def title(self): return u'Custom Title %s' % self.context.foo </code></pre> <p>This method is very similar to that suggested in this blog post:</p> <p><a href="http://davidjb.com/blog/2010/04/plone-and-dexterity-working-with-computed-fields">http://davidjb.com/blog/2010/04/plone-and-dexterity-working-with-computed-fields</a></p> <p>Unfortunately, this method stopped working after plone.app.dexterity beta and now my content items don't have their names assigned properly.</p> <p>Would anyone happen to know how to extend Dexterity's INameFromTitle behavior for very specific naming use-cases?</p> <p>Your help is much appreciated, thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload